usb: dwc2: Fix some error handling paths
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 5 May 2023 17:15:08 +0000 (19:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 May 2023 09:58:11 +0000 (18:58 +0900)
commitada050c69108bc34be13ecc11f7fad0f20ebadc4
treeeb95bd126dce20b24bda1a0013246af6890425d8
parent2f28c3c9c34742d501b623acf8ebfe3a7faed8a3
usb: dwc2: Fix some error handling paths

dwc2_driver_probe() calls dwc2_lowlevel_hw_init() which deassert some reset
lines.
Should an error happen in dwc2_lowlevel_hw_init() after calling
reset_control_deassert() or in the probe after calling
dwc2_lowlevel_hw_init(), the reset lines remain deasserted.

Add some devm_add_action_or_reset() calls to re-assert the lines if needed.

Update the remove function accordingly.

This change is compile-tested only.

Fixes: 83f8da562f8b ("usb: dwc2: Add reset control to dwc2")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/c64537b5339342bd00f7c2152b8fc23792b9f95a.1683306479.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc2/platform.c