Re: [PATCH v4 05/18] usb: typec: Add device managed typec_switch_register()

From: Andy Shevchenko
Date: Mon Sep 02 2024 - 07:22:27 EST


On Sat, Aug 31, 2024 at 09:06:43PM -0700, Stephen Boyd wrote:
> Simplify driver error paths by adding devm_typec_switch_register() which
> will unregister the typec switch when the parent device is unbound.

...

> +struct typec_switch_dev *
> +devm_typec_switch_register(struct device *parent,
> + const struct typec_switch_desc *desc)
> +{
> + int ret;
> + struct typec_switch_dev *switch_dev;
> +
> + switch_dev = typec_switch_register(parent ,desc);

Slipped typo, i.e. wrong location of the white space character.

> + if (IS_ERR(switch_dev))
> + return switch_dev;
> +
> + ret = devm_add_action_or_reset(parent, devm_typec_switch_unregister, switch_dev);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + return switch_dev;
> +}

--
With Best Regards,
Andy Shevchenko