Commit 6498613d authored by Quentin Lambert's avatar Quentin Lambert Committed by Greg Kroah-Hartman

staging: ozwpan: Move code from success handling to error handling

The original version was success handling rather than error handling,
therefore this patch reduces nesting.
Signed-off-by: default avatarQuentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e03b7297
...@@ -283,7 +283,9 @@ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) ...@@ -283,7 +283,9 @@ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags)
struct oz_endpoint *ep; struct oz_endpoint *ep;
ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags);
if (ep) { if (!ep)
return NULL;
INIT_LIST_HEAD(&ep->urb_list); INIT_LIST_HEAD(&ep->urb_list);
INIT_LIST_HEAD(&ep->link); INIT_LIST_HEAD(&ep->link);
ep->credit = -1; ep->credit = -1;
...@@ -291,7 +293,7 @@ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) ...@@ -291,7 +293,7 @@ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags)
ep->buffer_size = buffer_size; ep->buffer_size = buffer_size;
ep->buffer = (u8 *)(ep+1); ep->buffer = (u8 *)(ep+1);
} }
}
return ep; return ep;
} }
......
...@@ -103,10 +103,11 @@ void oz_pd_put(struct oz_pd *pd) ...@@ -103,10 +103,11 @@ void oz_pd_put(struct oz_pd *pd)
struct oz_pd *oz_pd_alloc(const u8 *mac_addr) struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
{ {
struct oz_pd *pd; struct oz_pd *pd;
int i;
pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC); pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC);
if (pd) { if (!pd)
int i; return NULL;
atomic_set(&pd->ref_count, 2); atomic_set(&pd->ref_count, 2);
for (i = 0; i < OZ_NB_APPS; i++) for (i = 0; i < OZ_NB_APPS; i++)
...@@ -130,7 +131,7 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr) ...@@ -130,7 +131,7 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
hrtimer_init(&pd->timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&pd->timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pd->heartbeat.function = oz_pd_heartbeat_event; pd->heartbeat.function = oz_pd_heartbeat_event;
pd->timeout.function = oz_pd_timeout_event; pd->timeout.function = oz_pd_timeout_event;
}
return pd; return pd;
} }
......
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