Skip to content

Commit 929b22e

Browse files
tititiou36gregkh
authored andcommitted
usb: misc: eud: Fix an error handling path in eud_probe()
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: 9a1bf58 ("usb: misc: eud: Add driver support for Embedded USB Debugger(EUD)") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/362908699275ecec078381b42d87c817c6965fc6.1648979948.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0543e4e commit 929b22e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/usb/misc/qcom_eud.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,16 @@ static int eud_probe(struct platform_device *pdev)
186186

187187
chip->dev = &pdev->dev;
188188

189-
ret = devm_add_action_or_reset(chip->dev, eud_role_switch_release, chip);
190-
if (ret)
191-
return dev_err_probe(chip->dev, ret,
192-
"failed to add role switch release action\n");
193-
194189
chip->role_sw = usb_role_switch_get(&pdev->dev);
195190
if (IS_ERR(chip->role_sw))
196191
return dev_err_probe(chip->dev, PTR_ERR(chip->role_sw),
197192
"failed to get role switch\n");
198193

194+
ret = devm_add_action_or_reset(chip->dev, eud_role_switch_release, chip);
195+
if (ret)
196+
return dev_err_probe(chip->dev, ret,
197+
"failed to add role switch release action\n");
198+
199199
chip->base = devm_platform_ioremap_resource(pdev, 0);
200200
if (IS_ERR(chip->base))
201201
return PTR_ERR(chip->base);

0 commit comments

Comments
 (0)