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

From: Heikki Krogerus
Date: Wed Nov 16 2022 - 07:18:20 EST


On Mon, Nov 14, 2022 at 06:44:46PM +0100, Sven Peter wrote:
> 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>

I think this should also automatically go to the stable tree.

Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
> 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)) {

thanks,

--
heikki