All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
To: lucas.p.stankus@gmail.com, lars@metafoo.de,
	Michael.Hennerich@analog.com, jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] iio: accel: adxl313_core: Use devm-managed mutex initialization
Date: Thu, 16 Apr 2026 10:46:29 +0530	[thread overview]
Message-ID: <20260416051631.551250-2-sanjayembedded@gmail.com> (raw)
In-Reply-To: <20260416051631.551250-1-sanjayembedded@gmail.com>

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

Use devm_mutex_init() to tie the mutex lifetime to the device and
improve debugging when CONFIG_DEBUG_MUTEXES is enabled.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/accel/adxl313_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/adxl313_core.c b/drivers/iio/accel/adxl313_core.c
index 83dcac17a042..2ca4ce90cd86 100644
--- a/drivers/iio/accel/adxl313_core.c
+++ b/drivers/iio/accel/adxl313_core.c
@@ -1243,7 +1243,9 @@ int adxl313_core_probe(struct device *dev,
 	data->regmap = regmap;
 	data->chip_info = chip_info;
 
-	mutex_init(&data->lock);
+	ret = devm_mutex_init(dev, &data->lock);
+	if (ret)
+		return ret;
 
 	indio_dev->name = chip_info->name;
 	indio_dev->info = &adxl313_info;
-- 
2.34.1


  reply	other threads:[~2026-04-16  5:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  5:16 [PATCH 0/3] iio: accel: adxl313: small cleanups and error-handling improvements Sanjay Chitroda
2026-04-16  5:16 ` Sanjay Chitroda [this message]
2026-04-16  8:25   ` [PATCH 1/3] iio: accel: adxl313_core: Use devm-managed mutex initialization Andy Shevchenko
2026-04-16  5:16 ` [PATCH 2/3] iio: accel: adxl313_core: use guard() to release mutex Sanjay Chitroda
2026-04-16  8:22   ` Andy Shevchenko
2026-04-16 18:22     ` Sanjay Chitroda
2026-04-16  5:16 ` [PATCH 3/3] iio: accel: adxl313: Use dev_err_probe Sanjay Chitroda
2026-04-16  8:24   ` Andy Shevchenko
2026-04-16 19:41     ` Sanjay Chitroda
2026-04-16  8:16 ` [PATCH 0/3] iio: accel: adxl313: small cleanups and error-handling improvements Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416051631.551250-2-sanjayembedded@gmail.com \
    --to=sanjayembeddedse@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.p.stankus@gmail.com \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.