]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
cdc_ncm: return -ENOMEM if kzalloc fails
authorDevendra Naga <devendra.aaru@gmail.com>
Fri, 29 Mar 2013 23:03:22 +0000 (23:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Mar 2013 21:31:24 +0000 (17:31 -0400)
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 <devendra.aaru@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ncm.c

index 4709fa3497cf2efcada053ccdefc06f7061971bc..44a989cd9fb2d718ab6822f75b4054c0ff2f4fd5 100644 (file)
@@ -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;