All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Cc: kbuild test robot <fengguang.wu@intel.com>,
	kbuild-all@01.org, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Andy Shevchenko <andy.schevchenko@gmail.com>,
	"Ong, Boon Leong" <boon.leong.ong@intel.com>,
	Darren Hart <dvhart@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/intel/quark: fix simple_return.cocci warnings
Date: Thu, 19 Feb 2015 11:33:44 +0100	[thread overview]
Message-ID: <20150219103344.GD2819@gmail.com> (raw)
In-Reply-To: <54E5BB87.3020206@nexus-software.ie>


* Bryan O'Donoghue <pure.logic@nexus-software.ie> wrote:

> On 19/02/15 10:25, Ingo Molnar wrote:
> 
> >>>-	ret = iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
> >>>+	return iosf_mbi_read(QRK_MBI_UNIT_MM, QRK_MBI_MM_READ,
> >>>  				reg++, &imr->wmask);
> >>>-	if (ret)
> >>>-		return ret;
> >>>-
> >>>-	return 0;
> >>>  }
> >>>
> >>>  /**
> >>>
> >>
> >>This flow was a change asked for and supplied in review
> >>feedback for Andy Shevchenko so NAK to this patch.
> >
> >But this pattern:
> >
> >	if (ret)
> >		return ret;
> >
> >	return 0;
> >
> >makes very little sense. Why is it done?
> >
> >Thanks,
> >
> >	Ingo
> 
> Feedback at review was that it's more consistent with the 
> code that comes before.

But that feedback makes very little sense. In C we don't 
ever want to write:

	if (ret)
		return ret;

	return 0;

Because we can return the fine value straight away:

	return ret;

regardless of what comes before.

Thanks,

	Ingo

  reply	other threads:[~2015-02-19 10:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201502191606.pTcFEBOs%fengguang.wu@intel.com>
2015-02-19  8:14 ` [PATCH] x86/intel/quark: fix ptr_ret.cocci warnings kbuild test robot
2015-02-19 10:12   ` Bryan O'Donoghue
2015-02-19 11:31   ` [tip:x86/platform] x86/intel/quark: Fix " tip-bot for Fengguang Wu
2015-02-19  8:14 ` [PATCH] x86/intel/quark: fix simple_return.cocci warnings kbuild test robot
2015-02-19 10:11   ` Bryan O'Donoghue
2015-02-19 10:25     ` Ingo Molnar
2015-02-19 10:31       ` Bryan O'Donoghue
2015-02-19 10:33         ` Ingo Molnar [this message]
2015-02-19 11:01           ` Bryan O'Donoghue
2015-02-19 11:31   ` [tip:x86/platform] x86/intel/quark: Fix " tip-bot for Fengguang Wu

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=20150219103344.GD2819@gmail.com \
    --to=mingo@kernel.org \
    --cc=andy.schevchenko@gmail.com \
    --cc=boon.leong.ong@intel.com \
    --cc=dvhart@linux.intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@zytor.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pure.logic@nexus-software.ie \
    --cc=tglx@linutronix.de \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.