public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Tomas Borquez <tomasborquez13@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-staging@lists.linux.dev,
	"Tomas Borquez" <tomasborquez13@gmail.com>
Subject: [PATCH v2 3/6] staging: iio: ad9832: convert to devm_mutex_init()
Date: Tue, 30 Dec 2025 17:34:56 -0300	[thread overview]
Message-ID: <20251230203459.28935-4-tomasborquez13@gmail.com> (raw)
In-Reply-To: <20251230203459.28935-1-tomasborquez13@gmail.com>

Use devm_mutex_init() for automatic resource cleanup when the device
is removed or probe fails.

Signed-off-by: Tomas Borquez <tomasborquez13@gmail.com>
---
 drivers/staging/iio/frequency/ad9832.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index 35d8d51d5c2b..4bb203a67046 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -310,7 +310,9 @@ static int ad9832_probe(struct spi_device *spi)
 		return dev_err_probe(dev, PTR_ERR(st->mclk), "failed to enable MCLK\n");
 
 	st->spi = spi;
-	mutex_init(&st->lock);
+	ret = devm_mutex_init(&spi->dev, &st->lock);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to initialize mutex\n");
 
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->info = &ad9832_info;
-- 
2.43.0


  parent reply	other threads:[~2025-12-30 20:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 20:34 [PATCH v2 0/6] staging: ad9832: driver cleanup Tomas Borquez
2025-12-30 20:34 ` [PATCH v2 1/6] staging: iio: ad9832: cleanup dev_err_probe() Tomas Borquez
2025-12-30 22:47   ` Andy Shevchenko
2025-12-31 18:02     ` Jonathan Cameron
2025-12-30 20:34 ` [PATCH v2 2/6] staging: iio: ad9832: convert to guard(mutex) Tomas Borquez
2025-12-30 22:50   ` Andy Shevchenko
2025-12-31 17:01     ` Tomas Borquez
2025-12-30 20:34 ` Tomas Borquez [this message]
2026-01-14  1:34   ` [PATCH v2 3/6] staging: iio: ad9832: convert to devm_mutex_init() Marcelo Schmitt
2025-12-30 20:34 ` [PATCH v2 4/6] staging: iio: ad9832: remove dds.h dependency Tomas Borquez
2025-12-30 22:46   ` Andy Shevchenko
2026-01-04  5:25     ` Tomas Borquez
2026-01-05 15:52       ` Andy Shevchenko
2025-12-31 18:09   ` Jonathan Cameron
2025-12-31 18:11     ` Jonathan Cameron
2026-01-04  5:38       ` Tomas Borquez
2026-01-11 12:13         ` Jonathan Cameron
2025-12-30 20:34 ` [PATCH v2 5/6] staging: iio: ad9832: convert to iio channels and ext_info attrs Tomas Borquez
2025-12-30 22:55   ` Andy Shevchenko
2025-12-31 17:08     ` Tomas Borquez
2026-01-11 12:20       ` Jonathan Cameron
2025-12-31 18:21   ` Jonathan Cameron
2025-12-30 20:34 ` [PATCH v2 6/6] staging: iio: ad9832: add sysfs documentation Tomas Borquez
2025-12-30 22:57   ` Andy Shevchenko
2025-12-31 18:35   ` 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=20251230203459.28935-4-tomasborquez13@gmail.com \
    --to=tomasborquez13@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --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