All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mfd: wm8400-core: Remove unnecessary goto
@ 2014-02-14  9:51 Sachin Kamat
  2014-02-14 11:31 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Sachin Kamat @ 2014-02-14  9:51 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>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
Changes since v1:
Changed (wm8400 == NULL) -> (!wm8400)
---
 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..e5eae751aa1b 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)
+		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] 2+ messages in thread

* Re: [PATCH v2] mfd: wm8400-core: Remove unnecessary goto
  2014-02-14  9:51 [PATCH v2] mfd: wm8400-core: Remove unnecessary goto Sachin Kamat
@ 2014-02-14 11:31 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2014-02-14 11:31 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>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> ---
> Changes since v1:
> Changed (wm8400 == NULL) -> (!wm8400)
> ---
>  drivers/mfd/wm8400-core.c |   22 +++++-----------------
>  1 file changed, 5 insertions(+), 17 deletions(-)

Nice little clean-up. 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] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  9:51 [PATCH v2] mfd: wm8400-core: Remove unnecessary goto Sachin Kamat
2014-02-14 11:31 ` Lee Jones

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.