summaryrefslogtreecommitdiff
path: root/drivers/nfc/pn533/usb.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-05-17 10:32:19 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2016-07-04 13:15:00 +0300
commit6d2f70cae481a2e8e85a244d3b2d36828dadff83 (patch)
tree6b8e75b375f2a032a559263ceab325c3d9e04f92 /drivers/nfc/pn533/usb.c
parentf86dec94e3a86c992a637df1c301a4df25a85801 (diff)
downloadlinux-6d2f70cae481a2e8e85a244d3b2d36828dadff83.tar.xz
NFC: pn533: double free on error in probe()
We can't pass devm_ allocated pointers to kfree() because they will be freed again after the drive is unloaded. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533/usb.c')
-rw-r--r--drivers/nfc/pn533/usb.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c
index 8ca060324b6a..33ed78be2750 100644
--- a/drivers/nfc/pn533/usb.c
+++ b/drivers/nfc/pn533/usb.c
@@ -464,10 +464,8 @@ static int pn533_usb_probe(struct usb_interface *interface,
return -ENOMEM;
in_buf = kzalloc(in_buf_len, GFP_KERNEL);
- if (!in_buf) {
- rc = -ENOMEM;
- goto out_free_phy;
- }
+ if (!in_buf)
+ return -ENOMEM;
phy->udev = usb_get_dev(interface_to_usbdev(interface));
phy->interface = interface;
@@ -554,8 +552,7 @@ error:
usb_free_urb(phy->out_urb);
usb_put_dev(phy->udev);
kfree(in_buf);
-out_free_phy:
- kfree(phy);
+
return rc;
}