Skip to contentSkip to conversation

staging: iio: impedance-analyzer: ad5933: use devm_mutex_init()

PATCH In review Nithishvelan M 2 participants 2 messages Oct 27

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: impedance-analyzer: ad5933: use devm_mutex_init()

Replace mutex_init() with devm_mutex_init() in ad5933_probe() and check its return value. The driver already uses devm_* helpers for its other resources and has no remove() callback, so this ensures the mutex is destroyed automatically on teardown when mutex debugging is enabled.

No functional change intended. Compile-tested only.

---
 drivers/staging/iio/impedance-analyzer/ad5933.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/iio/impedance-analyzer/ad5933.c +3 -1
index c05a5f4b4..51d73c5ab 100644
@@ -672,7 +672,9 @@ static int ad5933_probe(struct i2c_client *client)
 	i2c_set_clientdata(client, indio_dev);
 	st->client = client;
 
-	mutex_init(&st->lock);
+	ret = devm_mutex_init(&client->dev, &st->lock);
+	if (ret)
+		return ret;
 
 	ret = devm_regulator_get_enable_read_voltage(&client->dev, "vdd");
 	if (ret < 0)
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Nithishvelan M

Replace mutex_init() with devm_mutex_init() in ad5933_probe() and check its return value. The driver already uses devm_* helpers for its other resources and has no remove() callback, so this ensures the mutex is destroyed automatically on teardown when mutex debugging is enabled.

No functional change intended. Compile-tested only.

Signature · 2 lines
With Best Regards,
Andy Shevchenko