Skip to content

Commit dff4bdf

Browse files
embedded-essentialsjic23
authored andcommitted
iio: proximity: rfd77402: Use devm-managed mutex initialization
Use devm_mutex_init() to tie the mutex lifetime to the device and improve debugging when CONFIG_DEBUG_MUTEXES is enabled. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Shrikant Raskar <raskar.shree97@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 51eedb3 commit dff4bdf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/iio/proximity/rfd77402.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,10 @@ static int rfd77402_probe(struct i2c_client *client)
287287

288288
data = iio_priv(indio_dev);
289289
data->client = client;
290-
mutex_init(&data->lock);
290+
291+
ret = devm_mutex_init(&client->dev, &data->lock);
292+
if (ret)
293+
return ret;
291294

292295
indio_dev->info = &rfd77402_info;
293296
indio_dev->channels = rfd77402_channels;

0 commit comments

Comments
 (0)