From: Mark Brown <broonie@kernel.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: wangkailong@jari.cn, perex@perex.cz, tiwai@suse.com,
lgirdwood@gmail.com, motolav@gmail.com,
cezary.rojewski@intel.com, mkumard@nvidia.com,
pierre-louis.bossart@linux.intel.com,
kai.vehmanen@linux.intel.com, peter.ujfalusi@linux.intel.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA/ASoC: replace ternary operator with min()
Date: Wed, 26 Oct 2022 13:25:40 +0100 [thread overview]
Message-ID: <Y1knRM2jU8RhlFWn@sirena.org.uk> (raw)
In-Reply-To: <87pmefp30l.wl-tiwai@suse.de>
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
On Wed, Oct 26, 2022 at 07:28:26AM +0200, Takashi Iwai wrote:
> Mark Brown wrote:
> > On Tue, Oct 25, 2022 at 10:56:11PM +0800, wangkailong@jari.cn wrote:
> > > sound/soc/soc-ops.c:817: WARNING opportunity for min()
> > > kfree(uctl);
> > > - return err < 0 ? err : 0;
> > > + return min(err, 0);
> > I don't think this is a good warning, while I'm no big fan of the
> > ternery operator the new code is less clear about the intent than the
> > old code.
> Agreed. That use of ternery is a standard idiom.
> If we have to eliminate the use of ternery inevitably, it'd be better
> to introduce a new macro for clarity instead.
It looks like it's more about identifying a pattern that could be min()
but not being able to detect the semantics of why we're comparing
numbers.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2022-10-26 12:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 14:56 [PATCH] ALSA/ASoC: replace ternary operator with min() wangkailong
2022-10-25 17:01 ` Mark Brown
2022-10-26 5:28 ` Takashi Iwai
2022-10-26 12:25 ` Mark Brown [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=Y1knRM2jU8RhlFWn@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=cezary.rojewski@intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mkumard@nvidia.com \
--cc=motolav@gmail.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=wangkailong@jari.cn \
/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