mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: Melih Emik <melihemik@noirlang.tr>,
	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: Mon, 19 Oct 2026 12:23:16 +0300	[thread overview]
Message-ID: <atXhhJoQ86jOUSMS@ashevche-desk.local> (raw)
In-Reply-To: <20261018175558.71739ebc@systembl0wer>

On Sun, Oct 18, 2026 at 05:55:58PM +0200, Joshua Crofts wrote:
> 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.

If it was tested on a real HW, the summary (like a couple of words only)
is still good to have in the commit message to leave a trail of the actual
HW that makes the change appear.

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2026-10-19  9:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 10:26 Melih Emik
2026-10-18 15:55 ` Joshua Crofts
2026-10-19  8:59   ` Melih Emik
2026-10-19  9:23   ` Andy Shevchenko [this message]

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=atXhhJoQ86jOUSMS@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®