2014-02-12 09:15:31

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto

Return directly to avoid redundant lines of code.

Signed-off-by: Sachin Kamat <[email protected]>
---
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


2014-02-12 09:15:39

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config

stw481x_regmap_config is local to this file.

Signed-off-by: Sachin Kamat <[email protected]>
Cc: Linus Walleij <[email protected]>
---
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

2014-02-12 09:15:53

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c

devm_regmap_init_i2c can fail. Check for it.

Signed-off-by: Sachin Kamat <[email protected]>
Cc: Linus Walleij <[email protected]>
---
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

2014-02-12 09:16:19

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 2/4] mfd: max14577: Include missing err.h

Add this header explicitly for IS_ERR and friends.

Signed-off-by: Sachin Kamat <[email protected]>
---
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

2014-02-12 13:02:05

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config

On Wed, Feb 12, 2014 at 10:10 AM, Sachin Kamat <[email protected]> wrote:

> stw481x_regmap_config is local to this file.
>
> Signed-off-by: Sachin Kamat <[email protected]>
> Cc: Linus Walleij <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2014-02-14 09:37:42

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/4] mfd: wm8400-core: Remove unnecessary goto

> Return directly to avoid redundant lines of code.
>
> Signed-off-by: Sachin Kamat <[email protected]>
> ---
> 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 <[email protected]>

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

2014-02-14 09:39:51

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 2/4] mfd: max14577: Include missing err.h

> Add this header explicitly for IS_ERR and friends.
>
> Signed-off-by: Sachin Kamat <[email protected]>
> ---
> 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

2014-02-14 09:41:06

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 3/4] mfd: stw481x: Staticize stw481x_regmap_config

On Wed, 12 Feb 2014, Sachin Kamat wrote:

> stw481x_regmap_config is local to this file.
>
> Signed-off-by: Sachin Kamat <[email protected]>
> Cc: Linus Walleij <[email protected]>
> ---
> 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

2014-02-14 09:41:43

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 4/4] mfd: stw481x: Check the return value of devm_regmap_init_i2c

> devm_regmap_init_i2c can fail. Check for it.
>
> Signed-off-by: Sachin Kamat <[email protected]>
> Cc: Linus Walleij <[email protected]>
> ---
> 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