From: Julia Lawall <julia.lawall@inria.fr>
To: Guru Das Srinagesh <linux@gurudas.dev>
Cc: Nicolas Palix <nicolas.palix@imag.fr>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-kernel@vger.kernel.org, cocci@inria.fr,
Brian Masney <bmasney@redhat.com>,
linux-clk@vger.kernel.org
Subject: Re: [PATCH v2] coccinelle: Detect clk_register() anti-pattern
Date: Mon, 10 Aug 2026 10:03:42 +0200 (CEST) [thread overview]
Message-ID: <a5306584-b483-5ee-eada-e5efb8ea10a1@inria.fr> (raw)
In-Reply-To: <anlwF9n1KVaYcnH1@gurudas.dev>
> > > +@depends on context@
> > > +expression clk;
> > > +identifier voidfn =~ "^(dev_err|dev_warn|pr_err|pr_warn)$";
> > > +@@
> > > +
> > > +clk = \(clk_register\|devm_clk_register\)(...);
> > > +if ( IS_ERR(clk) )
> > > +{
> > > +...
> > > +*voidfn(...);
> > > +...
> > > +}
> >
> > This will only match an if with a then branch, no else branch. There is
> > actually one case in the kernel where there is a relevant if with an else
> > branch, so you may as well extend this to match that cas too. If you just
> > add else S, where S is a statement metavariable that is not used
> > elsewhere, then it will match either the case with an else or the case
> > with a then branch only.
> >
> > Likewise for the other rules.
>
> Done, thank you for catching the edge case which I'm guessing is
> drivers/media/platform/microchip/microchip-isc-clk.c.
Yes, that's the one.
julia
prev parent reply other threads:[~2026-08-10 8:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 6:20 [PATCH v2] coccinelle: Detect clk_register() anti-pattern Guru Das Srinagesh
2026-08-09 20:00 ` Julia Lawall
2026-08-10 6:30 ` Guru Das Srinagesh
2026-08-10 8:03 ` Julia Lawall [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=a5306584-b483-5ee-eada-e5efb8ea10a1@inria.fr \
--to=julia.lawall@inria.fr \
--cc=bmasney@redhat.com \
--cc=cocci@inria.fr \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@gurudas.dev \
--cc=mturquette@baylibre.com \
--cc=nicolas.palix@imag.fr \
--cc=sboyd@kernel.org \
/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