[PATCH 1/4] usb: typec: tipd: Cleanup resources if devm_tps6598_psy_register fails

From: Sven Peter
Date: Mon Nov 14 2022 - 12:44:58 EST


We can't just return if devm_tps6598_psy_register fails since previous
resources are not devres managed and have yet to be cleaned up.

Fixes: 10eb0b6ac63a ("usb: typec: tps6598x: Export some power supply properties")
Signed-off-by: Sven Peter <sven@xxxxxxxxxxxxx>
---
drivers/usb/typec/tipd/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index 748ff4f6b5f6..ebc786d728e2 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -827,7 +827,7 @@ static int tps6598x_probe(struct i2c_client *client)

ret = devm_tps6598_psy_register(tps);
if (ret)
- return ret;
+ goto err_role_put;

tps->port = typec_register_port(&client->dev, &typec_cap);
if (IS_ERR(tps->port)) {
--
2.25.1