aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2015-03-16 18:42:24 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-03-22 13:14:50 -0400
commit37920a74abd6fdf0696730ba80a07843a62c9c54 (patch)
tree254856eadad2f766bfaa2ea7f868f9be78030fcc /drivers/net/can
parent7e184c28636dce594426cd7d8781d52d1dd447cd (diff)
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>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/usb/gs_usb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index 009acc8641fc..8b4d3e6875eb 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -901,6 +901,8 @@ static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *
901 } 901 }
902 902
903 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 903 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
904 if (!dev)
905 return -ENOMEM;
904 init_usb_anchor(&dev->rx_submitted); 906 init_usb_anchor(&dev->rx_submitted);
905 907
906 atomic_set(&dev->active_channels, 0); 908 atomic_set(&dev->active_channels, 0);