summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2017-03-12 08:20:43 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-12 08:20:43 +0000
commit618692bd8a2f729b76084bdc40076fd21fe7fe12 (patch)
tree7d62020a2a4d271f21a544913409198d73aa0c5e /drivers/net
parent24764f437ab42ce34f812dee558488e9bd0983c1 (diff)
parent20bc8a897e48043339d4a396e654c81c39900108 (diff)
can: usb_8dev: Fix memory leak of priv->cmd_msg_buffer
am: 20bc8a897e Change-Id: Ieef9c24ff41bdc07f95887c9192d325328962a25
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/can/usb/usb_8dev.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c
index a731720f1d13..449b2a47f9a8 100644
--- a/drivers/net/can/usb/usb_8dev.c
+++ b/drivers/net/can/usb/usb_8dev.c
@@ -954,8 +954,8 @@ static int usb_8dev_probe(struct usb_interface *intf,
for (i = 0; i < MAX_TX_URBS; i++)
priv->tx_contexts[i].echo_index = MAX_TX_URBS;
- priv->cmd_msg_buffer = kzalloc(sizeof(struct usb_8dev_cmd_msg),
- GFP_KERNEL);
+ priv->cmd_msg_buffer = devm_kzalloc(&intf->dev, sizeof(struct usb_8dev_cmd_msg),
+ GFP_KERNEL);
if (!priv->cmd_msg_buffer)
goto cleanup_candev;
@@ -969,7 +969,7 @@ static int usb_8dev_probe(struct usb_interface *intf,
if (err) {
netdev_err(netdev,
"couldn't register CAN device: %d\n", err);
- goto cleanup_cmd_msg_buffer;
+ goto cleanup_candev;
}
err = usb_8dev_cmd_version(priv, &version);
@@ -990,9 +990,6 @@ static int usb_8dev_probe(struct usb_interface *intf,
cleanup_unregister_candev:
unregister_netdev(priv->netdev);
-cleanup_cmd_msg_buffer:
- kfree(priv->cmd_msg_buffer);
-
cleanup_candev:
free_candev(netdev);