From: Yang Yingliang Date: Wed, 16 Jun 2021 04:45:17 +0000 (+0800) Subject: usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe() X-Git-Tag: v5.14-rc1~64^2~32 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=9ea90e9fadb6cffb383ee23b132c36a88ee69019;p=linux-2.6-block.git usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe() Goto put_padctl to put refcount of device on error in tegra_xusb_probe() Fixes: 971ee247060d ("usb: xhci: tegra: Enable ELPG for runtime/system PM") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20210616044519.2183826-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index ce97ff054c68..f30030a3e51b 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -1454,12 +1454,16 @@ static int tegra_xusb_probe(struct platform_device *pdev) return PTR_ERR(tegra->padctl); np = of_parse_phandle(pdev->dev.of_node, "nvidia,xusb-padctl", 0); - if (!np) - return -ENODEV; + if (!np) { + err = -ENODEV; + goto put_padctl; + } tegra->padctl_irq = of_irq_get(np, 0); - if (tegra->padctl_irq <= 0) - return (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq; + if (tegra->padctl_irq <= 0) { + err = (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq; + goto put_padctl; + } tegra->host_clk = devm_clk_get(&pdev->dev, "xusb_host"); if (IS_ERR(tegra->host_clk)) {