* [PATCH] usb: misc: eud: Fix an error handling path in eud_probe()
@ 2022-04-03 9:59 Christophe JAILLET
0 siblings, 0 replies; only message in thread
From: Christophe JAILLET @ 2022-04-03 9:59 UTC (permalink / raw)
To: Souradeep Chowdhury, Andy Gross, Bjorn Andersson, Greg Kroah-Hartman
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-arm-msm,
linux-usb
It is odd to call devm_add_action_or_reset() before calling the function
that should be undone.
Either, the "_or_reset" part should be omitted, or the action should be
recorded after the resources have been allocated.
Switch the order of devm_add_action_or_reset() and usb_role_switch_get().
Fixes: 9a1bf58ccd44 ("usb: misc: eud: Add driver support for Embedded USB Debugger(EUD)")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/misc/qcom_eud.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
index f929bffdc5d1..b7f13df00764 100644
--- a/drivers/usb/misc/qcom_eud.c
+++ b/drivers/usb/misc/qcom_eud.c
@@ -186,16 +186,16 @@ static int eud_probe(struct platform_device *pdev)
chip->dev = &pdev->dev;
- ret = devm_add_action_or_reset(chip->dev, eud_role_switch_release, chip);
- if (ret)
- return dev_err_probe(chip->dev, ret,
- "failed to add role switch release action\n");
-
chip->role_sw = usb_role_switch_get(&pdev->dev);
if (IS_ERR(chip->role_sw))
return dev_err_probe(chip->dev, PTR_ERR(chip->role_sw),
"failed to get role switch\n");
+ ret = devm_add_action_or_reset(chip->dev, eud_role_switch_release, chip);
+ if (ret)
+ return dev_err_probe(chip->dev, ret,
+ "failed to add role switch release action\n");
+
chip->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(chip->base))
return PTR_ERR(chip->base);
--
2.32.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-03 9:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-03 9:59 [PATCH] usb: misc: eud: Fix an error handling path in eud_probe() Christophe JAILLET
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).