From: Wolfram Sang <wsa@the-dreams.de>
To: Lukasz Gemborowski <lukasz.gemborowski@nokia.com>
Cc: peda@axentia.se, linux-i2c@vger.kernel.org, alexander.sverdlin@nokia.com
Subject: Re: [PATCH] i2c: i2c-mux-reg: wrong condition checked for of_address_to_resource return value
Date: Mon, 27 Jun 2016 11:26:24 +0200 [thread overview]
Message-ID: <20160627092624.GC1602@katana> (raw)
In-Reply-To: <20160627092144.GA20023@nokia.com>
[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]
On Mon, Jun 27, 2016 at 11:21:48AM +0200, Lukasz Gemborowski wrote:
> of_address_to_resource return 0 on successful call but
> devm_ioremap_resource is called only if it returns non-zero value
>
> Signed-off-by: Lukasz Gemborowski <lukasz.gemborowski@nokia.com>
> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
> drivers/i2c/muxes/i2c-mux-reg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
> index 26e7c51..012a7ab 100644
> --- a/drivers/i2c/muxes/i2c-mux-reg.c
> +++ b/drivers/i2c/muxes/i2c-mux-reg.c
> @@ -145,7 +145,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
> mux->data.idle_in_use = true;
>
> /* map address from "reg" if exists */
> - if (of_address_to_resource(np, 0, &res)) {
> + if (!of_address_to_resource(np, 0, &res)) {
Minor nit: I prefer '== 0' in those cases to prevent the misleading
reading of "if not of_address_to_resource...". '== 0' can be easier read
as 'is OK'.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-06-27 9:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 9:21 [PATCH] i2c: i2c-mux-reg: wrong condition checked for of_address_to_resource return value Lukasz Gemborowski
2016-06-27 9:26 ` Wolfram Sang [this message]
2016-06-27 10:57 ` [PATCH v2] " Lukasz Gemborowski
2016-07-05 15:32 ` Wolfram Sang
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=20160627092624.GC1602@katana \
--to=wsa@the-dreams.de \
--cc=alexander.sverdlin@nokia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=lukasz.gemborowski@nokia.com \
--cc=peda@axentia.se \
/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;
as well as URLs for NNTP newsgroup(s).