backfire: swconfig: release switch in error path of swconfig_get_attr (backport of...
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 13 Jun 2010 11:45:40 +0000 (11:45 +0000)
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 13 Jun 2010 11:45:40 +0000 (11:45 +0000)
Signed-off-by: Karl Beldan <karl.beldan@sagemcom.com>
git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@21781 3c298f89-4303-0410-b956-a3cf2f4a3e73

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

index 21a6a7b8855207e921e07591847f6e97de255af2..e83e795b808a059baa153837f68ad8b0fcb56f7a 100644 (file)
@@ -684,7 +684,7 @@ swconfig_get_attr(struct sk_buff *skb, struct genl_info *info)
        memset(&val, 0, sizeof(val));
        attr = swconfig_lookup_attr(dev, info, &val);
        if (!attr || !attr->get)
-               goto error_dev;
+               goto error;
 
        if (attr->type == SWITCH_TYPE_PORTS) {
                val.value.ports = dev->portbuf;
@@ -733,9 +733,8 @@ swconfig_get_attr(struct sk_buff *skb, struct genl_info *info)
 nla_put_failure:
        if (msg)
                nlmsg_free(msg);
-error_dev:
-       swconfig_put_dev(dev);
 error:
+       swconfig_put_dev(dev);
        if (!err)
                err = -ENOMEM;
        return err;