summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorZhang Qilong <zhangqilong3@huawei.com>2020-11-23 17:58:09 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-09 17:25:21 +0300
commite5548b05631ec3e6bfdaef1cad28c799545b791b (patch)
treecb12dd2ed714d34835a976dfaa8d8fe723617323 /drivers/usb
parent3b78ef0da32f3288c292b2ecf680c31b4674b50d (diff)
downloadlinux-e5548b05631ec3e6bfdaef1cad28c799545b791b.tar.xz
usb: oxu210hp-hcd: Fix memory leak in oxu_create
usb_create_hcd will alloc memory for hcd, and we should call usb_put_hcd to free it when adding fails to prevent memory leak. Fixes: b92a78e582b1a ("usb host: Oxford OXU210HP HCD driver") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Link: https://lore.kernel.org/r/20201123145809.1456541-1-zhangqilong3@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index aa42df39e6a1..4300326b3730 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -4152,8 +4152,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev,
oxu->is_otg = otg;
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
- if (ret < 0)
+ if (ret < 0) {
+ usb_put_hcd(hcd);
return ERR_PTR(ret);
+ }
device_wakeup_enable(hcd->self.controller);
return hcd;