public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "David E. Box" <david.e.box@linux.intel.com>
To: Joe Perches <joe@perches.com>,
	hdegoede@redhat.com, gregkh@linuxfoundation.org,
	andriy.shevchenko@linux.intel.com, srinivas.pandruvada@intel.com,
	mgross@linux.intel.com
Cc: linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	Mark Gross <markgross@kernel.org>
Subject: Re: [PATCH V5 1/3] platform/x86: Add Intel Software Defined Silicon driver
Date: Fri, 04 Feb 2022 09:01:07 -0800	[thread overview]
Message-ID: <682714ab20540935c972adfa9304482ba6999a0c.camel@linux.intel.com> (raw)
In-Reply-To: <71d3f97b4d4937b6e57772a56603766be7dd1ac8.camel@perches.com>

On Fri, 2022-02-04 at 06:01 -0800, Joe Perches wrote:
> On Fri, 2022-02-04 at 05:23 -0800, David E. Box wrote:
> > On Fri, 2022-02-04 at 02:14 -0800, Joe Perches wrote:
> > > On Thu, 2022-02-03 at 21:30 -0800, David E. Box wrote:
> []
> > > >   - In binary attribute handlers where ret is only used for errors,
> > > >     replace,
> > > >               return (ret < 0) ? ret : size;
> > > >     with,
> > > >               return ret ?: size;
> > > 
> > > I think this style overly tricky.
> > > 
> > > Why not the canonical:
> > > 
> > > 	if (ret < 0)
> > > 		return ret;
> > > 
> > > 	return size;
> > 
> > I can see not using the 2 parameter shortcut of the ternary operator, but
> > the
> > regular 3 parameter expression is easy to read for simple operations.
> 
> The issue to me is it combines an error test and error return
> with the common return.

Ah, okay.

> 
> it's also being used and avoided / naked with the similar
> 
> 	return min(ret, size);
> 
> https://lore.kernel.org/lkml/20211116121014.1675-1-zhaoxiao@uniontech.com/T/

Thanks.


  reply	other threads:[~2022-02-04 17:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04  5:30 [PATCH V5 0/3] Intel Software Defined Silicon David E. Box
2022-02-04  5:30 ` [PATCH V5 1/3] platform/x86: Add Intel Software Defined Silicon driver David E. Box
2022-02-04  6:57   ` Greg KH
2022-02-04 10:14   ` Joe Perches
2022-02-04 13:23     ` David E. Box
2022-02-04 13:43       ` Greg KH
2022-02-04 14:01       ` Joe Perches
2022-02-04 17:01         ` David E. Box [this message]
2022-02-04  5:30 ` [PATCH V5 2/3] tools arch x86: Add Intel SDSi provisiong tool David E. Box
2022-02-04  5:30 ` [PATCH V5 3/3] selftests: sdsi: test sysfs setup David E. Box

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=682714ab20540935c972adfa9304482ba6999a0c.camel@linux.intel.com \
    --to=david.e.box@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@intel.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