Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 2/3] iio: magnetometer: yamaha-yas530: Use devm_mutex_init() for mutex initialization
Date: Fri,  8 May 2026 08:08:34 +0200	[thread overview]
Message-ID: <20260508060958.1086818-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260508060958.1086818-1-andriy.shevchenko@linux.intel.com>

Use devm_mutex_init() since it brings some benefits when
CONFIG_DEBUG_MUTEXES is enabled.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/magnetometer/yamaha-yas530.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index 2ed0d1b93985..d6efa8a595b0 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -1405,7 +1405,10 @@ static int yas5xx_probe(struct i2c_client *i2c)
 	yas5xx = iio_priv(indio_dev);
 	i2c_set_clientdata(i2c, indio_dev);
 	yas5xx->dev = dev;
-	mutex_init(&yas5xx->lock);
+
+	ret = devm_mutex_init(dev, &yas5xx->lock);
+	if (ret)
+		return ret;
 
 	ret = iio_read_mount_matrix(dev, &yas5xx->orientation);
 	if (ret)
-- 
2.50.1


  parent reply	other threads:[~2026-05-08  6:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  6:08 [PATCH v1 0/3] iio: magnetometer: yamaha-yas530: Ad-hoc cleanups Andy Shevchenko
2026-05-08  6:08 ` [PATCH v1 1/3] iio: magnetometer: yamaha-yas530: Get rid of i2c_client_get_device_id() Andy Shevchenko
2026-05-08  6:08 ` Andy Shevchenko [this message]
2026-05-08  6:08 ` [PATCH v1 3/3] iio: magnetometer: yamaha-yas530: replace usleep_range() with fsleep() Andy Shevchenko
2026-05-08 13:32 ` [PATCH v1 0/3] iio: magnetometer: yamaha-yas530: Ad-hoc cleanups Jonathan Cameron

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=20260508060958.1086818-3-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox