All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Gemborowski <lukasz.gemborowski@nokia.com>
To: Wolfram Sang <wsa@the-dreams.de>,
	peda@axentia.se, linux-i2c@vger.kernel.org
Cc: alexander.sverdlin@nokia.com
Subject: [PATCH v2] i2c: i2c-mux-reg: wrong condition checked for of_address_to_resource return value
Date: Mon, 27 Jun 2016 12:57:47 +0200	[thread overview]
Message-ID: <20160627105747.GA20280@nokia.com> (raw)
In-Reply-To: <20160627092624.GC1602@katana>

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>
---
Changelog:
v2:
    Changed style of conditional expression as suggested by Wolfram.
 
 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..c6a90b4 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) == 0) {
 		mux->data.reg_size = resource_size(&res);
 		mux->data.reg = devm_ioremap_resource(&pdev->dev, &res);
 		if (IS_ERR(mux->data.reg))
-- 
2.5.0

  reply	other threads:[~2016-06-27 10:58 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
2016-06-27 10:57   ` Lukasz Gemborowski [this message]
2016-07-05 15:32     ` [PATCH v2] " 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=20160627105747.GA20280@nokia.com \
    --to=lukasz.gemborowski@nokia.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=wsa@the-dreams.de \
    /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.