Re: [PATCH v2 3/5] iio: light: tcs3472: use devm for resource management

From: Joshua Crofts

Date: Wed May 13 2026 - 04:08:59 EST


On Wed, 13 May 2026 at 00:40, Aldo Conte <aldocontelk@xxxxxxxxx> wrote:
> static int tcs3472_probe(struct i2c_client *client)
> {
> + struct device *dev = &client->dev;
> struct tcs3472_data *data;
> struct iio_dev *indio_dev;
> int ret;
>
> - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> + indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> if (indio_dev == NULL)

Not introduced by this patch, but `if (!indio_dev)` is better if you're checking
for NULL (checkpatch.pl would probably mention it during a run).

Since you're moving the driver to use devm_* functions, might I suggest
moving mutex_init() to devm_mutex_init() in the probe() function? Something
along the lines of the following:

ret = devm_mutex_int(dev, &data->lock);
if (ret)
return ret;

--
Kind regards

CJD