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: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
e03b7297f8
Коммит
6498613d2c
|
@ -283,7 +283,9 @@ static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags)
|
|||
struct oz_endpoint *ep;
|
||||
|
||||
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->link);
|
||||
ep->credit = -1;
|
||||
|
@ -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 = (u8 *)(ep+1);
|
||||
}
|
||||
}
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 *pd;
|
||||
int i;
|
||||
|
||||
pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC);
|
||||
if (pd) {
|
||||
int i;
|
||||
if (!pd)
|
||||
return NULL;
|
||||
|
||||
atomic_set(&pd->ref_count, 2);
|
||||
for (i = 0; i < OZ_NB_APPS; i++)
|
||||
|
@ -130,7 +131,7 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
|
|||
hrtimer_init(&pd->timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
||||
pd->heartbeat.function = oz_pd_heartbeat_event;
|
||||
pd->timeout.function = oz_pd_timeout_event;
|
||||
}
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче