mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Luben Tuikov <luben.tuikov@amd.com>, Andy Whitcroft <apw@canonical.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: checkpatch.pl warning for "return" with value
Date: Fri, 17 Apr 2020 14:25:04 -0700	[thread overview]
Message-ID: <b2c2f344419156c75c6f58258cab6e7a60c2d4a9.camel@perches.com> (raw)
In-Reply-To: <8859753b-c7c9-78ec-20cc-ce424b436b13@amd.com>

On Fri, 2020-04-17 at 14:52 -0400, Luben Tuikov wrote:
> Also checking and returning from a function, doesn't
> always have to be binary. It could be,
> 
> 	if (A) {
> 		...;
> 		return X;
> 	} else if (B) {
> 		...;
> 		return Y;
> 	} else {
> 		...;
> 		return Z;
> 	}
> }
> 
> And interestingly, checkpatch.pl doesn't complain for
> the triplet above. But if I remove condition B, above,
> it does complain.

My recollection is false positives existed so the
else if case was not wanted.



      parent reply	other threads:[~2020-04-17 21:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a1eea414-2422-3a9f-b9bb-1ab7d6113dd6@amd.com>
2020-04-17 17:32 ` Joe Perches
2020-04-17 18:52   ` Luben Tuikov
2020-04-17 18:55     ` Joe Perches
2020-04-17 21:25     ` Joe Perches [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=b2c2f344419156c75c6f58258cab6e7a60c2d4a9.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luben.tuikov@amd.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®