Changeset 25619


Ignore:
Timestamp:
2011-02-20T18:24:15+01:00 (6 years ago)
Author:
florian
Message:

[package] switch: fix switch-robo device reference counting

Fix incorrect device reference counting by switch-robo.

Signed-off-by: George Kashperko <george@…>

Location:
trunk/package/switch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/switch/Makefile

    r22145 r25619  
    11#  
    2 # Copyright (C) 2006 OpenWrt.org 
     2# Copyright (C) 2006-2011 OpenWrt.org 
    33# 
    44# This is free software, licensed under the GNU General Public License v2. 
     
    1010 
    1111PKG_NAME:=kmod-switch 
    12 PKG_RELEASE:=3 
     12PKG_RELEASE:=4 
    1313 
    1414include $(INCLUDE_DIR)/package.mk 
  • trunk/package/switch/src/switch-robo.c

    r22320 r25619  
    302302        __u32 phyid; 
    303303        unsigned int i; 
    304         int err; 
     304        int err = 1; 
    305305 
    306306        printk(KERN_INFO PFX "Probing device %s: ", devname); 
     
    332332                    (mii->phy_id != ROBO_PHY_ADDR_TG3)) { 
    333333                        printk("Invalid phy address (%d)\n", mii->phy_id); 
    334                         return 1; 
     334                        goto done; 
    335335                } 
    336336                robo.use_et = 0; 
     
    345345        if (phyid == 0xffffffff || phyid == 0x55210022) { 
    346346                printk("No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid); 
    347                 return 1; 
     347                goto done; 
    348348        } 
    349349 
     
    362362        err = robo_switch_enable(); 
    363363        if (err) 
    364                 return err; 
     364                goto done; 
     365        err = 0; 
    365366 
    366367        printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid, 
    367368                robo.is_5350 ? " It's a 5350." : ""); 
    368         return 0; 
     369 
     370done: 
     371        if (err) { 
     372                dev_put(robo.dev); 
     373                robo.dev = NULL; 
     374        } 
     375        return err; 
    369376} 
    370377 
     
    611618{ 
    612619        switch_unregister_driver(DRIVER_NAME); 
     620        if (robo.dev) 
     621                dev_put(robo.dev); 
    613622        kfree(robo.device); 
    614623} 
Note: See TracChangeset for help on using the changeset viewer.