From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
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 07:28:26 +0200 [thread overview]
Message-ID: <87pmefp30l.wl-tiwai@suse.de> (raw)
In-Reply-To: <Y1gWbN2/Tbf1jeL6@sirena.org.uk>
On Tue, 25 Oct 2022 19:01:32 +0200,
Mark Brown wrote:
>
> On Tue, Oct 25, 2022 at 10:56:11PM +0800, wangkailong@jari.cn wrote:
> > Fix the following coccicheck warning:
> >
> > 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.
thanks,
Takashi
next prev parent reply other threads:[~2022-10-26 5:28 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 [this message]
2022-10-26 12:25 ` Mark Brown
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=87pmefp30l.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.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=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