public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Caizhiyong <caizhiyong@hisilicon.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Wanglin (Albert)" <albert.wanglin@hisilicon.com>,
	Levente Kurusa <ilevex.linux@gmail.com>,
	Levente Kurusa <levex@linux.com>
Subject: Re: [PATCH] regmap: Fix 'ret' would return an uninitialized value
Date: Thu, 14 Nov 2013 12:58:13 +0000	[thread overview]
Message-ID: <20131114125813.GP26614@sirena.org.uk> (raw)
In-Reply-To: <C3050A4DBA34F345975765E43127F10F1C08B5D7@szxeml512-mbs.china.huawei.com>

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

On Mon, Nov 11, 2013 at 11:35:52AM +0000, Caizhiyong wrote:

> +	int ret = 0;

With the if statement below you probably don't need to do this any more.

> +	if (num_regs <= 0) {
> +		WARN_ONCE(1, "Call regmap_register_patch with num_regs <= 0.");
> +		return 0;
> +	}

WARN_ONCE actually returns the result of the test so you should be able
to write this as:

	if (WARN_ONCE(num_regs <= 0))
		return 0;

which is slightly neater.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-11-14 12:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 11:35 [PATCH] regmap: Fix 'ret' would return an uninitialized value Caizhiyong
2013-11-14 12:58 ` Mark Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-15 11:30 Caizhiyong
2013-11-15 13:00 ` Geyslan Gregório Bem
2013-11-15 13:27   ` Levente Kurusa
2013-11-15 15:52     ` Geyslan Gregório Bem
2013-11-15 15:58       ` Mark Brown
2013-11-15 16:09         ` Geyslan Gregório Bem
2013-11-15 16:03       ` Levente Kurusa
2013-11-18 12:29 Caizhiyong
2013-11-18 12:35 ` Mark Brown
2013-11-18 13:24 ` Geyslan Gregório Bem

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=20131114125813.GP26614@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=albert.wanglin@hisilicon.com \
    --cc=caizhiyong@hisilicon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilevex.linux@gmail.com \
    --cc=levex@linux.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox