usb: typec: tipd: Fix spurious fwnode_handle_put in error path
authorSven Peter <sven@svenpeter.dev>
Mon, 14 Nov 2022 17:44:47 +0000 (18:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:27 +0000 (13:14 +0100)
commit4524599a6a29117fe0671ff3e05663fe8cdd08ff
treecb0acc54e984e7d72d5445be2c6e11b31496c35d
parentb0d86eacc84980945ccd1ae16c7e4adb5f8d36ec
usb: typec: tipd: Fix spurious fwnode_handle_put in error path

[ Upstream commit 782c70edc4852a5d39be12377a85501546236212 ]

The err_role_put error path always calls fwnode_handle_put to release
the fwnode. This path can be reached after probe itself has already
released that fwnode though. Fix that by moving fwnode_handle_put in the
happy path to the very end.

Fixes: 18a6c866bb19 ("usb: typec: tps6598x: Add USB role switching logic")
Signed-off-by: Sven Peter <sven@svenpeter.dev>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20221114174449.34634-2-sven@svenpeter.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/typec/tipd/core.c