swconfig: fix lock imbalance in unregister_switch()
[openwrt.git] / target / linux / generic-2.6 / files / drivers / net / phy / swconfig.c
index bb49df8..dea8e78 100644 (file)
@@ -92,7 +92,7 @@ swconfig_set_vlan_ports(struct switch_dev *dev, const struct switch_attr *attr,
                if (ports[i].id >= dev->ports)
                        return -EINVAL;
 
-               if (dev->set_port_pvid && !(ports[i].flags & SWITCH_PORT_FLAG_TAGGED))
+               if (dev->set_port_pvid && !(ports[i].flags & (1 << SWITCH_PORT_FLAG_TAGGED)))
                        dev->set_port_pvid(dev, ports[i].id, val->port_vlan);
        }
 
@@ -688,7 +688,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;
@@ -737,9 +737,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;
@@ -761,6 +760,7 @@ swconfig_send_switch(struct sk_buff *msg, u32 pid, u32 seq, int flags,
        NLA_PUT_STRING(msg, SWITCH_ATTR_DEV_NAME, dev->devname);
        NLA_PUT_U32(msg, SWITCH_ATTR_VLANS, dev->vlans);
        NLA_PUT_U32(msg, SWITCH_ATTR_PORTS, dev->ports);
+       NLA_PUT_U32(msg, SWITCH_ATTR_CPU_PORT, dev->cpu_port);
 
        return genlmsg_end(msg, hdr);
 nla_put_failure:
@@ -886,6 +886,7 @@ unregister_switch(struct switch_dev *dev)
        swconfig_lock();
        list_del(&dev->dev_list);
        swconfig_unlock();
+       spin_unlock(&dev->lock);
 }
 EXPORT_SYMBOL_GPL(unregister_switch);
 
This page took 0.024125 seconds and 4 git commands to generate.