can: gs_usb: check for kzalloc allocation failure
authorColin Ian King <colin.king@canonical.com>
Mon, 16 Mar 2015 22:42:24 +0000 (22:42 +0000)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 22 Mar 2015 17:14:50 +0000 (18:14 +0100)
commit37920a74abd6fdf0696730ba80a07843a62c9c54
tree254856eadad2f766bfaa2ea7f868f9be78030fcc
parent7e184c28636dce594426cd7d8781d52d1dd447cd
can: gs_usb: check for kzalloc allocation failure

smatch detected the following issue:
drivers/net/can/usb/gs_usb.c:904 gs_usb_probe() error:
   potential null dereference 'dev'.  (kzalloc returns null)

Add a check for null return from kzalloc and return -ENOMEM

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c