From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Melih Emik <melihemik@noirlang.tr>
Cc: jic23@kernel.org, gregkh@linuxfoundation.org, nuno.sa@analog.com,
Michael.Hennerich@analog.com, dlechner@baylibre.com,
andy@kernel.org, linux-iio@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
linux@analog.com
Subject: Re: [PATCH] staging: iio: frequency: ad9832: use guard(mutex)
Date: Sun, 18 Oct 2026 17:55:58 +0200 [thread overview]
Message-ID: <20261018175558.71739ebc@systembl0wer> (raw)
In-Reply-To: <20261018102604.73380-1-melihemik@noirlang.tr>
On Sun, 18 Oct 2026 13:26:04 +0300
Melih Emik <melihemik@noirlang.tr> wrote:
> In ad9832_write(), manual mutex handling via mutex_lock() and
> mutex_unlock() necessitates error-exit trampolines (goto error_ret),
> intermediate variables, and deferred returns. This pattern is prone
> to unlock-omission bugs during refactoring and clutters the control
> flow.
>
> Modernize the locking by using guard(mutex) from <linux/cleanup.h>.
> Scope-based resource management automatically releases the lock upon
> exiting the lexical scope, which enables immediate error propagation
> at call sites, removes the error_ret label, and simplifies the control
> flow across all switch cases.
>
> Tested:
> - Compiled with W=1 on x86_64 with zero warnings.
> - Verified with lockdep and debug mutexes enabled
> (CONFIG_PROVE_LOCKING=y, CONFIG_DEBUG_MUTEXES=y).
> - Boot-tested full bzImage in QEMU with initcall_debug, confirming
> successful driver initialization (ad9832_driver_init returned 0)
> and zero lockdep warnings.
> - Disassembly inspected via objdump to ensure mutex_unlock on all
> exit paths.
> - Verified with scripts/checkpatch.pl (0 errors, 0 warnings).
The Tested: part goes under the ---, no need to preserve this info
in the git log.
--
Kind regards,
Joshua Crofts
next prev parent reply other threads:[~2026-10-18 15:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 10:26 [PATCH] staging: iio: frequency: ad9832: use guard(mutex) Melih Emik
2026-10-18 15:55 ` Joshua Crofts [this message]
2026-10-19 8:59 ` Melih Emik
2026-10-19 9:23 ` Andy Shevchenko
-- strict thread matches above, loose matches on Subject: below --
2026-11-10 16:47 Nithishvelan M
2026-11-10 17:28 ` Andy Shevchenko
2026-11-11 6:52 ` Dan Carpenter
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=20261018175558.71739ebc@systembl0wer \
--to=joshua.crofts1@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux@analog.com \
--cc=melihemik@noirlang.tr \
--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.