* [PATCH] usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_get_init_data()
@ 2020-11-17 1:14 Yu Kuai
0 siblings, 0 replies; only message in thread
From: Yu Kuai @ 2020-11-17 1:14 UTC (permalink / raw)
To: Peter.Chen, gregkh, shawnguo, s.hauer
Cc: linux-usb, linux-arm-kernel, linux-kernel, yukuai3, yi.zhang,
zhangxiaoxu5
if of_find_device_by_node() succeed, usbmisc_get_init_data() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.
Fixes: commit ef12da914ed6 ("usb: chipidea: imx: properly check for usbmisc")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 25c65accf089..d4b1069b86ec 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -138,9 +138,13 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
misc_pdev = of_find_device_by_node(args.np);
of_node_put(args.np);
- if (!misc_pdev || !platform_get_drvdata(misc_pdev))
+ if (!misc_pdev)
return ERR_PTR(-EPROBE_DEFER);
+ if (!platform_get_drvdata(misc_pdev)) {
+ put_device(&misc_pdev->dev);
+ return ERR_PTR(-EPROBE_DEFER);
+ }
data->dev = &misc_pdev->dev;
/*
--
2.25.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-17 1:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 1:14 [PATCH] usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_get_init_data() Yu Kuai
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).