From: Devendra Naga Date: Fri, 29 Mar 2013 23:03:22 +0000 (+0000) Subject: cdc_ncm: return -ENOMEM if kzalloc fails X-Git-Tag: firefly_0821_release~3680^2~548^2~266 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8f0923c17d34ac838b7f57709f87fe33f76ee219;p=firefly-linux-kernel-4.4.55.git cdc_ncm: return -ENOMEM if kzalloc fails 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 4709fa3497cf..44a989cd9fb2 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -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;