[PATCH v4 2/6] iio: light: stk3310: handle all remove logic with devm callbacks
Aren
aren at peacevolution.org
Sun Nov 10 10:38:39 PST 2024
On Mon, Nov 04, 2024 at 10:32:08AM +0200, Andy Shevchenko wrote:
> On Sat, Nov 02, 2024 at 03:50:37PM -0400, Aren Moynihan wrote:
> > Using devm callbacks helps to make the ordering of probe / remove
> > operations easier to reason about and removes some duplicate code
> > between the probe error path and driver remove.
>
> Where is SoB?
Oops that got lost in a rebase
> ...
>
> > + ret = devm_add_action_or_reset(&client->dev, stk3310_set_state_disable, data);
>
> Why not simply 'dev' as in below call?
I was trying to avoid refactoring the entire function to replace
&client->dev with dev, I'll add a patch for that to the next revision.
> > + if (ret)
> > + return dev_err_probe(dev, ret, "failed to register cleanup function\n");
>
> ...
>
> > - mutex_init(&data->lock);
> > + devm_mutex_init(&client->dev, &data->lock);
>
> Missed error check, otherwise what's the point?
>
>
> Also can add a temporary variable for 'dev'.
Yup, fixing... I need to read the docs / function type more carefully
sometimes.
Thanks
- Aren
More information about the linux-arm-kernel
mailing list