mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-03 21:24:06 +02:00
[package] switch: fix switch-robo device reference counting
Fix incorrect device reference counting by switch-robo. Signed-off-by: George Kashperko <george@znau.edu.ua> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25619 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
560efaedc4
commit
48578aa816
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
include $(INCLUDE_DIR)/kernel.mk
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
PKG_NAME:=kmod-switch
|
PKG_NAME:=kmod-switch
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ static int robo_probe(char *devname)
|
|||||||
{
|
{
|
||||||
__u32 phyid;
|
__u32 phyid;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int err;
|
int err = 1;
|
||||||
|
|
||||||
printk(KERN_INFO PFX "Probing device %s: ", devname);
|
printk(KERN_INFO PFX "Probing device %s: ", devname);
|
||||||
strcpy(robo.ifr.ifr_name, devname);
|
strcpy(robo.ifr.ifr_name, devname);
|
||||||
@ -331,7 +331,7 @@ static int robo_probe(char *devname)
|
|||||||
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
|
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
|
||||||
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
|
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
|
||||||
printk("Invalid phy address (%d)\n", mii->phy_id);
|
printk("Invalid phy address (%d)\n", mii->phy_id);
|
||||||
return 1;
|
goto done;
|
||||||
}
|
}
|
||||||
robo.use_et = 0;
|
robo.use_et = 0;
|
||||||
/* The robo has a fixed PHY address that is different from the
|
/* The robo has a fixed PHY address that is different from the
|
||||||
@ -344,7 +344,7 @@ static int robo_probe(char *devname)
|
|||||||
|
|
||||||
if (phyid == 0xffffffff || phyid == 0x55210022) {
|
if (phyid == 0xffffffff || phyid == 0x55210022) {
|
||||||
printk("No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
|
printk("No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
|
||||||
return 1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the device ID */
|
/* Get the device ID */
|
||||||
@ -361,11 +361,18 @@ static int robo_probe(char *devname)
|
|||||||
robo_switch_reset();
|
robo_switch_reset();
|
||||||
err = robo_switch_enable();
|
err = robo_switch_enable();
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto done;
|
||||||
|
err = 0;
|
||||||
|
|
||||||
printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
|
printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
|
||||||
robo.is_5350 ? " It's a 5350." : "");
|
robo.is_5350 ? " It's a 5350." : "");
|
||||||
return 0;
|
|
||||||
|
done:
|
||||||
|
if (err) {
|
||||||
|
dev_put(robo.dev);
|
||||||
|
robo.dev = NULL;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -610,6 +617,8 @@ static int __init robo_init(void)
|
|||||||
static void __exit robo_exit(void)
|
static void __exit robo_exit(void)
|
||||||
{
|
{
|
||||||
switch_unregister_driver(DRIVER_NAME);
|
switch_unregister_driver(DRIVER_NAME);
|
||||||
|
if (robo.dev)
|
||||||
|
dev_put(robo.dev);
|
||||||
kfree(robo.device);
|
kfree(robo.device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user