kernel: swconfig: add a missing unlock in error path
authorGabor Juhos <juhosg@openwrt.org>
Fri, 4 Nov 2011 14:38:31 +0000 (14:38 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 4 Nov 2011 14:38:31 +0000 (14:38 +0000)
SVN-Revision: 28753

target/linux/generic/files/drivers/net/phy/swconfig.c

index 88fa244bc89c081702161de003f2477e3a624203..2038330ba27895bffe517262cd2609e79601840a 100644 (file)
@@ -894,8 +894,10 @@ register_switch(struct switch_dev *dev, struct net_device *netdev)
        }
        i = find_first_zero_bit(&in_use, max_switches);
 
-       if (i == max_switches)
+       if (i == max_switches) {
+               swconfig_unlock();
                return -ENFILE;
+       }
 
        /* fill device name */
        snprintf(dev->devname, IFNAMSIZ, SWCONFIG_DEVNAME, i);