All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sachin Kamat <sachin.kamat@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: lee.jones@linaro.org, sachin.kamat@linaro.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c
Date: Wed, 12 Feb 2014 14:40:13 +0530	[thread overview]
Message-ID: <1392196213-20576-4-git-send-email-sachin.kamat@linaro.org> (raw)
In-Reply-To: <1392196213-20576-1-git-send-email-sachin.kamat@linaro.org>

devm_regmap_init_i2c can fail. Check for it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/stw481x.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mfd/stw481x.c b/drivers/mfd/stw481x.c
index cc42f88586f6..7ceb3df09e25 100644
--- a/drivers/mfd/stw481x.c
+++ b/drivers/mfd/stw481x.c
@@ -186,6 +186,12 @@ static int stw481x_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, stw481x);
 	stw481x->client = client;
 	stw481x->map = devm_regmap_init_i2c(client, &stw481x_regmap_config);
+	if (IS_ERR(stw481x->map)) {
+		ret = PTR_ERR(stw481x->map);
+		dev_err(&client->dev, "Failed to allocate register map: %d\n",
+			ret);
+		return ret;
+	}
 
 	ret = stw481x_startup(stw481x);
 	if (ret) {
-- 
1.7.9.5


  parent reply	other threads:[~2014-02-12  9:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12  9:10 [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Sachin Kamat
2014-02-12  9:10 ` [PATCH 2/4] mfd: max14577: Include missing err.h Sachin Kamat
2014-02-14  9:39   ` Lee Jones
2014-02-12  9:10 ` [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config Sachin Kamat
2014-02-12 13:02   ` Linus Walleij
2014-02-14  9:40   ` Lee Jones
2014-02-12  9:10 ` Sachin Kamat [this message]
2014-02-14  9:41   ` [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c Lee Jones
2014-02-14  9:37 ` [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Lee Jones

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=1392196213-20576-4-git-send-email-sachin.kamat@linaro.org \
    --to=sachin.kamat@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --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 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.