Skip to content

Commit

Permalink
cdc_ncm: return -ENOMEM if kzalloc fails
Browse files Browse the repository at this point in the history
return -ENOMEM instead if kzalloc of cdc_ncm_ctx structure is failed.

and also remove the comparision of ctx structure with NULL and make
it as !ctx.

Signed-off-by: Devendra Naga <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Devendra Naga authored and davem330 committed Mar 30, 2013
1 parent 537aadc commit 8f0923c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/usb/cdc_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
u8 iface_no;

ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (ctx == NULL)
return -ENODEV;
if (!ctx)
return -ENOMEM;

hrtimer_init(&ctx->tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
ctx->tx_timer.function = &cdc_ncm_tx_timer_cb;
Expand Down

0 comments on commit 8f0923c

Please sign in to comment.