Commit a44755d8 authored by Salym Senyonga's avatar Salym Senyonga Committed by Greg Kroah-Hartman

Staging: ozwpan: reduce indent levels in oz_binding_add().

When hit error then we can return immediately. This makes the code
simpler and lets us remove some indenting.
Signed-off-by: default avatarSalym Senyonga <salymsash@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e9e4433e
...@@ -665,31 +665,29 @@ void oz_binding_add(const char *net_dev) ...@@ -665,31 +665,29 @@ void oz_binding_add(const char *net_dev)
struct oz_binding *binding; struct oz_binding *binding;
binding = kmalloc(sizeof(struct oz_binding), GFP_KERNEL); binding = kmalloc(sizeof(struct oz_binding), GFP_KERNEL);
if (binding) { if (!binding)
binding->ptype.type = __constant_htons(OZ_ETHERTYPE); return;
binding->ptype.func = oz_pkt_recv;
if (net_dev && *net_dev) { binding->ptype.type = __constant_htons(OZ_ETHERTYPE);
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN); binding->ptype.func = oz_pkt_recv;
oz_dbg(ON, "Adding binding: %s\n", net_dev); if (net_dev && *net_dev) {
binding->ptype.dev = memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
dev_get_by_name(&init_net, net_dev); oz_dbg(ON, "Adding binding: %s\n", net_dev);
if (binding->ptype.dev == NULL) { binding->ptype.dev = dev_get_by_name(&init_net, net_dev);
oz_dbg(ON, "Netdev %s not found\n", net_dev); if (binding->ptype.dev == NULL) {
kfree(binding); oz_dbg(ON, "Netdev %s not found\n", net_dev);
binding = NULL; kfree(binding);
} return;
} else {
oz_dbg(ON, "Binding to all netcards\n");
memset(binding->name, 0, OZ_MAX_BINDING_LEN);
binding->ptype.dev = NULL;
}
if (binding) {
dev_add_pack(&binding->ptype);
spin_lock_bh(&g_binding_lock);
list_add_tail(&binding->link, &g_binding);
spin_unlock_bh(&g_binding_lock);
} }
} else {
oz_dbg(ON, "Binding to all netcards\n");
memset(binding->name, 0, OZ_MAX_BINDING_LEN);
binding->ptype.dev = NULL;
} }
dev_add_pack(&binding->ptype);
spin_lock_bh(&g_binding_lock);
list_add_tail(&binding->link, &g_binding);
spin_unlock_bh(&g_binding_lock);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment