summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/generic/files/drivers/net/phy/swconfig.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c
index 88fa244bc..2038330ba 100644
--- a/target/linux/generic/files/drivers/net/phy/swconfig.c
+++ b/target/linux/generic/files/drivers/net/phy/swconfig.c
@@ -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);