public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto
@ 2014-02-12  9:10 Sachin Kamat
  2014-02-12  9:10 ` [PATCH 2/4] mfd: max14577: Include missing err.h Sachin Kamat
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Sachin Kamat @ 2014-02-12  9:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sachin.kamat

Return directly to avoid redundant lines of code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/mfd/wm8400-core.c |   22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c
index d66d256551fb..8788fd1f0a83 100644
--- a/drivers/mfd/wm8400-core.c
+++ b/drivers/mfd/wm8400-core.c
@@ -161,31 +161,19 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
 	struct wm8400 *wm8400;
-	int ret;
 
 	wm8400 = devm_kzalloc(&i2c->dev, sizeof(struct wm8400), GFP_KERNEL);
-	if (wm8400 == NULL) {
-		ret = -ENOMEM;
-		goto err;
-	}
+	if (wm8400 == NULL)
+		return -ENOMEM;
 
 	wm8400->regmap = devm_regmap_init_i2c(i2c, &wm8400_regmap_config);
-	if (IS_ERR(wm8400->regmap)) {
-		ret = PTR_ERR(wm8400->regmap);
-		goto err;
-	}
+	if (IS_ERR(wm8400->regmap))
+		return PTR_ERR(wm8400->regmap);
 
 	wm8400->dev = &i2c->dev;
 	i2c_set_clientdata(i2c, wm8400);
 
-	ret = wm8400_init(wm8400, dev_get_platdata(&i2c->dev));
-	if (ret != 0)
-		goto err;
-
-	return 0;
-
-err:
-	return ret;
+	return wm8400_init(wm8400, dev_get_platdata(&i2c->dev));
 }
 
 static int wm8400_i2c_remove(struct i2c_client *i2c)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] mfd: max14577: Include missing err.h
  2014-02-12  9:10 [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Sachin Kamat
@ 2014-02-12  9:10 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Sachin Kamat @ 2014-02-12  9:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sachin.kamat

Add this header explicitly for IS_ERR and friends.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/mfd/max14577.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 2ac2f2d7cea6..88cf5811ce3b 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -18,6 +18,7 @@
  * This driver is based on max8997.c
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/mfd/core.h>
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config
  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-12  9:10 ` Sachin Kamat
  2014-02-12 13:02   ` Linus Walleij
  2014-02-14  9:40   ` Lee Jones
  2014-02-12  9:10 ` [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c Sachin Kamat
  2014-02-14  9:37 ` [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Lee Jones
  3 siblings, 2 replies; 9+ messages in thread
From: Sachin Kamat @ 2014-02-12  9:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sachin.kamat, Linus Walleij

stw481x_regmap_config is local to this file.

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

diff --git a/drivers/mfd/stw481x.c b/drivers/mfd/stw481x.c
index 1243d5c6a448..cc42f88586f6 100644
--- a/drivers/mfd/stw481x.c
+++ b/drivers/mfd/stw481x.c
@@ -167,7 +167,7 @@ static struct mfd_cell stw481x_cells[] = {
 	},
 };
 
-const struct regmap_config stw481x_regmap_config = {
+static const struct regmap_config stw481x_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c
  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-12  9:10 ` [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config Sachin Kamat
@ 2014-02-12  9:10 ` Sachin Kamat
  2014-02-14  9:41   ` Lee Jones
  2014-02-14  9:37 ` [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Lee Jones
  3 siblings, 1 reply; 9+ messages in thread
From: Sachin Kamat @ 2014-02-12  9:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: lee.jones, sachin.kamat, Linus Walleij

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2014-02-12 13:02 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel@vger.kernel.org, Lee Jones

On Wed, Feb 12, 2014 at 10:10 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:

> stw481x_regmap_config is local to this file.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto
  2014-02-12  9:10 [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Sachin Kamat
                   ` (2 preceding siblings ...)
  2014-02-12  9:10 ` [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c Sachin Kamat
@ 2014-02-14  9:37 ` Lee Jones
  3 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2014-02-14  9:37 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel

> Return directly to avoid redundant lines of code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/mfd/wm8400-core.c |   22 +++++-----------------
>  1 file changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c
> index d66d256551fb..8788fd1f0a83 100644
> --- a/drivers/mfd/wm8400-core.c
> +++ b/drivers/mfd/wm8400-core.c
> @@ -161,31 +161,19 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
>  			    const struct i2c_device_id *id)
>  {
>  	struct wm8400 *wm8400;
> -	int ret;
>  
>  	wm8400 = devm_kzalloc(&i2c->dev, sizeof(struct wm8400), GFP_KERNEL);
> -	if (wm8400 == NULL) {
> -		ret = -ENOMEM;
> -		goto err;
> -	}
> +	if (wm8400 == NULL)

While you're here please change this to the preferred 'if (!wm8400)'.

<snip>

Otherwise nice clean-up.

When you fix the above and resubmit, do so with my:
  Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] mfd: max14577: Include missing err.h
  2014-02-12  9:10 ` [PATCH 2/4] mfd: max14577: Include missing err.h Sachin Kamat
@ 2014-02-14  9:39   ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2014-02-14  9:39 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel

> Add this header explicitly for IS_ERR and friends.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/mfd/max14577.c |    1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Lee Jones @ 2014-02-14  9:40 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, Linus Walleij

On Wed, 12 Feb 2014, Sachin Kamat wrote:

> stw481x_regmap_config is local to this file.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/stw481x.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied with Linus' Ack.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c
  2014-02-12  9:10 ` [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c Sachin Kamat
@ 2014-02-14  9:41   ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2014-02-14  9:41 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, Linus Walleij

> 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(+)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-14  9:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c Sachin Kamat
2014-02-14  9:41   ` Lee Jones
2014-02-14  9:37 ` [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox