Re: [PATCH v4 2/6] iio: light: stk3310: handle all remove logic with devm callbacks
From: Andy Shevchenko
Date: Mon Nov 04 2024 - 03:32:27 EST
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?
...
> + ret = devm_add_action_or_reset(&client->dev, stk3310_set_state_disable, data);
Why not simply 'dev' as in below call?
> + 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'.
--
With Best Regards,
Andy Shevchenko