Re: [PATCH v4 7/8] iio: light: opt3001: switch driver to managed resources
From: Jonathan Cameron
Date: Wed May 27 2026 - 14:28:06 EST
On Mon, 25 May 2026 10:20:21 +0200
Joshua Crofts via B4 Relay <devnull+joshua.crofts1.gmail.com@xxxxxxxxxx> wrote:
> From: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
>
> Move the driver to use devm_* functions to automate resource
> management and simplify error handling. This also allows removal
> of the opt3001_remove() function.
>
> Signed-off-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
One trivial thing in here. If the rest looks good I might just fix it up.
> @@ -836,7 +865,10 @@ static int opt3001_probe(struct i2c_client *client)
> opt->client = client;
> opt->chip_info = i2c_get_match_data(client);
>
> - mutex_init(&opt->lock);
> + ret = devm_mutex_init(dev, &opt->lock);
> + if (ret)
> + return ret;
> +
> init_waitqueue_head(&opt->result_ready_queue);
> i2c_set_clientdata(client, iio);
Sashiko noted this isn't used any more so can go.