linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 1/3] usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe()
@ 2021-06-16  4:45 Yang Yingliang
  2021-06-16  4:45 ` [PATCH -next 2/3] usb: host: xhci-tegra: Add missing of_node_put() " Yang Yingliang
  2021-06-16  4:45 ` [PATCH -next 3/3] usb: host: xhci-tegra: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-06-16  4:45 UTC (permalink / raw)
  To: linux-kernel, linux-tegra, linux-usb; +Cc: gregkh, thierry.reding

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 <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/host/xhci-tegra.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 937b78cba89b..281abf10f9fd 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1450,12 +1450,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)) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH -next 2/3] usb: host: xhci-tegra: Add missing of_node_put() in tegra_xusb_probe()
  2021-06-16  4:45 [PATCH -next 1/3] usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe() Yang Yingliang
@ 2021-06-16  4:45 ` Yang Yingliang
  2021-06-16  4:45 ` [PATCH -next 3/3] usb: host: xhci-tegra: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
  1 sibling, 0 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-06-16  4:45 UTC (permalink / raw)
  To: linux-kernel, linux-tegra, linux-usb; +Cc: gregkh, thierry.reding

This node pointer is returned by of_parse_phandle() with refcount
incremented in this function. of_node_put() on it before exitting
this function.

Fixes: 971ee247060d ("usb: xhci: tegra: Enable ELPG for runtime/system PM")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/host/xhci-tegra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 281abf10f9fd..8d8e867876ad 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1751,6 +1751,7 @@ static int tegra_xusb_probe(struct platform_device *pdev)
 put_powerdomains:
 	tegra_xusb_powerdomain_remove(&pdev->dev, tegra);
 put_padctl:
+	of_node_put(np);
 	tegra_xusb_padctl_put(tegra->padctl);
 	return err;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH -next 3/3] usb: host: xhci-tegra: Use devm_platform_get_and_ioremap_resource()
  2021-06-16  4:45 [PATCH -next 1/3] usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe() Yang Yingliang
  2021-06-16  4:45 ` [PATCH -next 2/3] usb: host: xhci-tegra: Add missing of_node_put() " Yang Yingliang
@ 2021-06-16  4:45 ` Yang Yingliang
  1 sibling, 0 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-06-16  4:45 UTC (permalink / raw)
  To: linux-kernel, linux-tegra, linux-usb; +Cc: gregkh, thierry.reding

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/host/xhci-tegra.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 8d8e867876ad..575fa89a783f 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1422,8 +1422,7 @@ static int tegra_xusb_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tegra->regs = devm_ioremap_resource(&pdev->dev, regs);
+	tegra->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &regs);
 	if (IS_ERR(tegra->regs))
 		return PTR_ERR(tegra->regs);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-16  4:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16  4:45 [PATCH -next 1/3] usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe() Yang Yingliang
2021-06-16  4:45 ` [PATCH -next 2/3] usb: host: xhci-tegra: Add missing of_node_put() " Yang Yingliang
2021-06-16  4:45 ` [PATCH -next 3/3] usb: host: xhci-tegra: Use devm_platform_get_and_ioremap_resource() Yang Yingliang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).