Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1431499 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2016-06-26 15:40 +0200 |
| Last post | 2016-06-28 17:10 +0200 |
| Articles | 20 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 0/6] mfd: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 15:40 +0200
[PATCH 1/6] mfd: twl-core: Return directly after a failed platform_device_alloc() in add_numbered_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 15:50 +0200
Re: [PATCH 1/6] mfd: twl-core: Return directly after a failed platform_device_alloc() in add_numbered_child() Lee Jones <lee.jones@linaro.org> - 2016-06-28 17:10 +0200
[PATCH 2/6] mfd: twl-core: Refactoring for add_numbered_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 15:50 +0200
Re: [PATCH 2/6] mfd: twl-core: Refactoring for add_numbered_child() Lee Jones <lee.jones@linaro.org> - 2016-06-28 17:10 +0200
[PATCH 3/6] mfd: dm355evm_msp: Return directly after a failed platform_device_alloc() in add_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 15:50 +0200
[PATCH 5/6] mfd: smsc-ece1099: Delete an unnecessary variable initialisation in smsc_i2c_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 16:00 +0200
[PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 16:00 +0200
Re: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() Lee Jones <lee.jones@linaro.org> - 2016-06-28 17:10 +0200
Re: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-28 17:50 +0200
Re: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() Lee Jones <lee.jones@linaro.org> - 2016-06-28 18:40 +0200
[PATCH] mfd: dm355evm_msp: Refactoring for add_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-30 22:20 +0200
Re: [PATCH] mfd: dm355evm_msp: Refactoring for add_child() Joe Perches <joe@perches.com> - 2016-06-30 22:50 +0200
Re: [PATCH] mfd: dm355evm_msp: Refactoring for add_child() Lee Jones <lee.jones@linaro.org> - 2016-06-30 23:00 +0200
Re: mfd: dm355evm_msp: Refactoring for add_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-01 16:50 +0200
Re: mfd: dm355evm_msp: Refactoring for add_child() Joe Perches <joe@perches.com> - 2016-07-01 18:30 +0200
Re: [PATCH] mfd: dm355evm_msp: Refactoring for add_child() Lee Jones <lee.jones@linaro.org> - 2016-07-01 11:20 +0200
Re: mfd: dm355evm_msp: Refactoring for add_child() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-01 17:00 +0200
[PATCH 6/6] mfd: smsc-ece1099: Return directly after a function failure in smsc_i2c_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-26 16:00 +0200
Re: [PATCH 0/6] mfd: Fine-tuning for three function implementations Lee Jones <lee.jones@linaro.org> - 2016-06-28 17:10 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 15:40 +0200 |
| Subject | [PATCH 0/6] mfd: Fine-tuning for three function implementations |
| Message-ID | <rOis1-3vu-13@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 15:25:43 +0200
Several update suggestions were taken into account
from static source code analysis.
Markus Elfring (6):
twl-core: Return directly after a failed platform_device_alloc()
in add_numbered_child()
twl-core: Refactoring for add_numbered_child()
dm355evm_msp: Return directly after a failed platform_device_alloc()
in add_child()
dm355evm_msp: Refactoring for add_child()
smsc-ece1099: Delete an unnecessary variable initialisation
in smsc_i2c_probe()
smsc-ece1099: Return directly after a function failure
in smsc_i2c_probe()
drivers/mfd/dm355evm_msp.c | 25 ++++++++++++-------------
drivers/mfd/smsc-ece1099.c | 11 ++++-------
drivers/mfd/twl-core.c | 28 +++++++++++++---------------
3 files changed, 29 insertions(+), 35 deletions(-)
--
2.9.0
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 15:50 +0200 |
| Subject | [PATCH 1/6] mfd: twl-core: Return directly after a failed platform_device_alloc() in add_numbered_child() |
| Message-ID | <rOiBH-3AL-1@gated-at.bofh.it> |
| In reply to | #1431499 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 12:25:36 +0200
The platform_device_put() function was called in one case by the
add_numbered_child() function during error handling even if the passed
variable "pdev" contained a null pointer.
Return directly in this case.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mfd/twl-core.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 831696e..9458c6d 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -622,11 +622,8 @@ add_numbered_child(unsigned mod_no, const char *name, int num,
twl = &twl_priv->twl_modules[sid];
pdev = platform_device_alloc(name, num);
- if (!pdev) {
- dev_dbg(&twl->client->dev, "can't alloc dev\n");
- status = -ENOMEM;
- goto err;
- }
+ if (!pdev)
+ return ERR_PTR(-ENOMEM);
pdev->dev.parent = &twl->client->dev;
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-06-28 17:10 +0200 |
| Subject | Re: [PATCH 1/6] mfd: twl-core: Return directly after a failed platform_device_alloc() in add_numbered_child() |
| Message-ID | <rP2Od-hD-23@gated-at.bofh.it> |
| In reply to | #1431503 |
On Sun, 26 Jun 2016, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 26 Jun 2016 12:25:36 +0200
Please use `git send-email` when sending patches to the list.
> The platform_device_put() function was called in one case by the
> add_numbered_child() function during error handling even if the passed
> variable "pdev" contained a null pointer.
> Return directly in this case.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mfd/twl-core.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Applied though, thanks.
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index 831696e..9458c6d 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -622,11 +622,8 @@ add_numbered_child(unsigned mod_no, const char *name, int num,
> twl = &twl_priv->twl_modules[sid];
>
> pdev = platform_device_alloc(name, num);
> - if (!pdev) {
> - dev_dbg(&twl->client->dev, "can't alloc dev\n");
> - status = -ENOMEM;
> - goto err;
> - }
> + if (!pdev)
> + return ERR_PTR(-ENOMEM);
>
> pdev->dev.parent = &twl->client->dev;
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 15:50 +0200 |
| Subject | [PATCH 2/6] mfd: twl-core: Refactoring for add_numbered_child() |
| Message-ID | <rOiBH-3AL-15@gated-at.bofh.it> |
| In reply to | #1431499 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 13:03:59 +0200
Adjust jump targets according to the Linux coding style convention.
Another check for the variable "status" can be omitted then at the end.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
drivers/mfd/twl-core.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 9458c6d..a49d3db 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -631,7 +631,7 @@ add_numbered_child(unsigned mod_no, const char *name, int num,
status = platform_device_add_data(pdev, pdata, pdata_len);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add platform_data\n");
- goto err;
+ goto put_device;
}
}
@@ -644,21 +644,22 @@ add_numbered_child(unsigned mod_no, const char *name, int num,
status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add irqs\n");
- goto err;
+ goto put_device;
}
}
status = platform_device_add(pdev);
- if (status == 0)
- device_init_wakeup(&pdev->dev, can_wakeup);
+ if (status)
+ goto put_device;
+
+ device_init_wakeup(&pdev->dev, can_wakeup);
-err:
- if (status < 0) {
- platform_device_put(pdev);
- dev_err(&twl->client->dev, "can't add %s dev\n", name);
- return ERR_PTR(status);
- }
return &pdev->dev;
+
+put_device:
+ platform_device_put(pdev);
+ dev_err(&twl->client->dev, "failed to add device %s\n", name);
+ return ERR_PTR(status);
}
static inline struct device *add_child(unsigned mod_no, const char *name,
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-06-28 17:10 +0200 |
| Subject | Re: [PATCH 2/6] mfd: twl-core: Refactoring for add_numbered_child() |
| Message-ID | <rP2Od-hD-3@gated-at.bofh.it> |
| In reply to | #1431505 |
On Sun, 26 Jun 2016, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 26 Jun 2016 13:03:59 +0200
>
> Adjust jump targets according to the Linux coding style convention.
> Another check for the variable "status" can be omitted then at the end.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/mfd/twl-core.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index 9458c6d..a49d3db 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -631,7 +631,7 @@ add_numbered_child(unsigned mod_no, const char *name, int num,
> status = platform_device_add_data(pdev, pdata, pdata_len);
> if (status < 0) {
> dev_dbg(&pdev->dev, "can't add platform_data\n");
> - goto err;
> + goto put_device;
> }
> }
>
> @@ -644,21 +644,22 @@ add_numbered_child(unsigned mod_no, const char *name, int num,
> status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1);
> if (status < 0) {
> dev_dbg(&pdev->dev, "can't add irqs\n");
> - goto err;
> + goto put_device;
> }
> }
>
> status = platform_device_add(pdev);
> - if (status == 0)
> - device_init_wakeup(&pdev->dev, can_wakeup);
> + if (status)
> + goto put_device;
> +
> + device_init_wakeup(&pdev->dev, can_wakeup);
>
> -err:
> - if (status < 0) {
> - platform_device_put(pdev);
> - dev_err(&twl->client->dev, "can't add %s dev\n", name);
> - return ERR_PTR(status);
> - }
> return &pdev->dev;
> +
> +put_device:
> + platform_device_put(pdev);
> + dev_err(&twl->client->dev, "failed to add device %s\n", name);
> + return ERR_PTR(status);
> }
>
> static inline struct device *add_child(unsigned mod_no, const char *name,
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 15:50 +0200 |
| Subject | [PATCH 3/6] mfd: dm355evm_msp: Return directly after a failed platform_device_alloc() in add_child() |
| Message-ID | <rOiBI-3AL-19@gated-at.bofh.it> |
| In reply to | #1431499 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 13:40:35 +0200
The platform_device_put() function was called in one case by the
add_child() function during error handling even if the passed
variable "pdev" contained a null pointer.
Return directly in this case.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mfd/dm355evm_msp.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
index 14661ec..270e19c 100644
--- a/drivers/mfd/dm355evm_msp.c
+++ b/drivers/mfd/dm355evm_msp.c
@@ -199,11 +199,8 @@ static struct device *add_child(struct i2c_client *client, const char *name,
int status;
pdev = platform_device_alloc(name, -1);
- if (!pdev) {
- dev_dbg(&client->dev, "can't alloc dev\n");
- status = -ENOMEM;
- goto err;
- }
+ if (!pdev)
+ return ERR_PTR(-ENOMEM);
device_init_wakeup(&pdev->dev, can_wakeup);
pdev->dev.parent = &client->dev;
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 16:00 +0200 |
| Subject | [PATCH 5/6] mfd: smsc-ece1099: Delete an unnecessary variable initialisation in smsc_i2c_probe() |
| Message-ID | <rOiLo-3E7-1@gated-at.bofh.it> |
| In reply to | #1431499 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 14:14:54 +0200
The variable "ret" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mfd/smsc-ece1099.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
index 7f89e89..2aaf89f 100644
--- a/drivers/mfd/smsc-ece1099.c
+++ b/drivers/mfd/smsc-ece1099.c
@@ -36,7 +36,7 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
{
struct smsc *smsc;
int devid, rev, venid_l, venid_h;
- int ret = 0;
+ int ret;
smsc = devm_kzalloc(&i2c->dev, sizeof(struct smsc),
GFP_KERNEL);
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 16:00 +0200 |
| Subject | [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rOiLo-3E7-5@gated-at.bofh.it> |
| In reply to | #1431499 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 13:56:58 +0200
Adjust jump targets according to the Linux coding style convention.
Another check for the variable "status" can be omitted then at the end.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mfd/dm355evm_msp.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
index 270e19c..baf6075 100644
--- a/drivers/mfd/dm355evm_msp.c
+++ b/drivers/mfd/dm355evm_msp.c
@@ -209,7 +209,7 @@ static struct device *add_child(struct i2c_client *client, const char *name,
status = platform_device_add_data(pdev, pdata, pdata_len);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add platform_data\n");
- goto err;
+ goto put_device;
}
}
@@ -222,19 +222,21 @@ static struct device *add_child(struct i2c_client *client, const char *name,
status = platform_device_add_resources(pdev, &r, 1);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add irq\n");
- goto err;
+ goto put_device;
}
}
status = platform_device_add(pdev);
-err:
- if (status < 0) {
- platform_device_put(pdev);
- dev_err(&client->dev, "can't add %s dev\n", name);
- return ERR_PTR(status);
- }
+ if (status)
+ goto put_device;
+
return &pdev->dev;
+
+put_device:
+ platform_device_put(pdev);
+ dev_err(&client->dev, "failed to add device %s\n", name);
+ return ERR_PTR(status);
}
static int add_children(struct i2c_client *client)
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-06-28 17:10 +0200 |
| Subject | Re: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rP2Od-hD-5@gated-at.bofh.it> |
| In reply to | #1431508 |
On Sun, 26 Jun 2016, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 26 Jun 2016 13:56:58 +0200
>
> Adjust jump targets according to the Linux coding style convention.
> Another check for the variable "status" can be omitted then at the end.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mfd/dm355evm_msp.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
> index 270e19c..baf6075 100644
> --- a/drivers/mfd/dm355evm_msp.c
> +++ b/drivers/mfd/dm355evm_msp.c
> @@ -209,7 +209,7 @@ static struct device *add_child(struct i2c_client *client, const char *name,
> status = platform_device_add_data(pdev, pdata, pdata_len);
> if (status < 0) {
> dev_dbg(&pdev->dev, "can't add platform_data\n");
> - goto err;
> + goto put_device;
> }
> }
>
> @@ -222,19 +222,21 @@ static struct device *add_child(struct i2c_client *client, const char *name,
> status = platform_device_add_resources(pdev, &r, 1);
> if (status < 0) {
> dev_dbg(&pdev->dev, "can't add irq\n");
> - goto err;
> + goto put_device;
> }
> }
>
> status = platform_device_add(pdev);
>
Remove this line too.
> -err:
> - if (status < 0) {
> - platform_device_put(pdev);
> - dev_err(&client->dev, "can't add %s dev\n", name);
> - return ERR_PTR(status);
> - }
> + if (status)
> + goto put_device;
> +
> return &pdev->dev;
> +
> +put_device:
> + platform_device_put(pdev);
> + dev_err(&client->dev, "failed to add device %s\n", name);
> + return ERR_PTR(status);
> }
>
> static int add_children(struct i2c_client *client)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-28 17:50 +0200 |
| Subject | Re: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rP3qV-uu-9@gated-at.bofh.it> |
| In reply to | #1433046 |
>> @@ -222,19 +222,21 @@ static struct device *add_child(struct i2c_client *client, const char *name,
>> status = platform_device_add_resources(pdev, &r, 1);
>> if (status < 0) {
>> dev_dbg(&pdev->dev, "can't add irq\n");
>> - goto err;
>> + goto put_device;
>> }
>> }
>>
>> status = platform_device_add(pdev);
>>
>
> Remove this line too.
Do you propose the deletion of a blank line here?
Did you skip this update suggestion while the other patches were finally accepted?
Regards,
Markus
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-06-28 18:40 +0200 |
| Subject | Re: [PATCH 4/6] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rP4dj-11e-5@gated-at.bofh.it> |
| In reply to | #1433076 |
On Tue, 28 Jun 2016, SF Markus Elfring wrote:
> >> @@ -222,19 +222,21 @@ static struct device *add_child(struct i2c_client *client, const char *name,
> >> status = platform_device_add_resources(pdev, &r, 1);
> >> if (status < 0) {
> >> dev_dbg(&pdev->dev, "can't add irq\n");
> >> - goto err;
> >> + goto put_device;
> >> }
> >> }
> >>
> >> status = platform_device_add(pdev);
> >>
> >
> > Remove this line too.
>
> Do you propose the deletion of a blank line here?
Yes.
> Did you skip this update suggestion while the other patches were finally accepted?
I don't know what this means.
The other patches in the set have been accepted. Please fix this one
and send it again on its own.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-30 22:20 +0200 |
| Subject | [PATCH] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rPQBk-5Bp-7@gated-at.bofh.it> |
| In reply to | #1433102 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 30 Jun 2016 21:54:51 +0200
Adjust jump targets according to the Linux coding style convention.
Another check for the variable "status" can be omitted then at the end.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mfd/dm355evm_msp.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
index 270e19c..86eca61 100644
--- a/drivers/mfd/dm355evm_msp.c
+++ b/drivers/mfd/dm355evm_msp.c
@@ -209,7 +209,7 @@ static struct device *add_child(struct i2c_client *client, const char *name,
status = platform_device_add_data(pdev, pdata, pdata_len);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add platform_data\n");
- goto err;
+ goto put_device;
}
}
@@ -222,19 +222,20 @@ static struct device *add_child(struct i2c_client *client, const char *name,
status = platform_device_add_resources(pdev, &r, 1);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add irq\n");
- goto err;
+ goto put_device;
}
}
status = platform_device_add(pdev);
+ if (status)
+ goto put_device;
-err:
- if (status < 0) {
- platform_device_put(pdev);
- dev_err(&client->dev, "can't add %s dev\n", name);
- return ERR_PTR(status);
- }
return &pdev->dev;
+
+put_device:
+ platform_device_put(pdev);
+ dev_err(&client->dev, "failed to add device %s\n", name);
+ return ERR_PTR(status);
}
static int add_children(struct i2c_client *client)
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-06-30 22:50 +0200 |
| Subject | Re: [PATCH] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rPR4m-5Ld-19@gated-at.bofh.it> |
| In reply to | #1434830 |
On Thu, 2016-06-30 at 22:15 +0200, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Thu, 30 Jun 2016 21:54:51 +0200 > > Adjust jump targets according to the Linux coding style convention. > Another check for the variable "status" can be omitted then at the > end. Two headers in this email: References: <566ABCD9.1060404@users.sourceforge.net> <5682D228.7070902@users.sourceforge.net> <20160111082922.GB14104@x1> <05b7db2a-437a-60ac-d289-71d2150e7f5f@users.sourceforge.net> <de3598c4-f85a-6807-303a-55ee0ac707f2@users.sourceforge.net> <20160608111442.GB14888@dell> <e4eaf0b4-e539-b400-c8a2-70f210cee1fa@users.sourceforge.net> <75c1cc23-3a2d-db78-d0f2-b5934b18e828@users.sourceforge.net> <20160628150725.GL24982@dell> <c220895b-e56f-dc95-500d-0cf9d2f51777@users.sourceforge.net> <20160628163146.GG29166@dell> In-reply-to: <20160628163146.GG29166@dell> Can you please fix your email client to _not_ send References: and In-reply-to: headers when sending new patches? Thanks. Even better would be to use git send-email for these patches.
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-06-30 23:00 +0200 |
| Subject | Re: [PATCH] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rPRe1-5Ou-1@gated-at.bofh.it> |
| In reply to | #1434839 |
On Thu, 30 Jun 2016, Joe Perches wrote: > On Thu, 2016-06-30 at 22:15 +0200, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Thu, 30 Jun 2016 21:54:51 +0200 > > > > Adjust jump targets according to the Linux coding style convention. > > Another check for the variable "status" can be omitted then at the > > end. > > Two headers in this email: > > References: <566ABCD9.1060404@users.sourceforge.net> <5682D228.7070902@users.sourceforge.net> <20160111082922.GB14104@x1> <05b7db2a-437a-60ac-d289-71d2150e7f5f@users.sourceforge.net> <de3598c4-f85a-6807-303a-55ee0ac707f2@users.sourceforge.net> <20160608111442.GB14888@dell> <e4eaf0b4-e539-b400-c8a2-70f210cee1fa@users.sourceforge.net> <75c1cc23-3a2d-db78-d0f2-b5934b18e828@users.sourceforge.net> <20160628150725.GL24982@dell> <c220895b-e56f-dc95-500d-0cf9d2f51777@users.sourceforge.net> <20160628163146.GG29166@dell> > In-reply-to: <20160628163146.GG29166@dell> > > Can you please fix your email client to _not_ send References: > and In-reply-to: headers when sending new patches? Thanks. > > Even better would be to use git send-email for these patches. Yes, I've mentioned this before. I now have a gargantuan threaded mess consisting of 53 mails in my inbox. Please submit patches using `git send-email`, not forgetting to increase your submission each time you submit i.e [PATCH v2] and send them independently i.e. not attached to previous submissions. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-07-01 16:50 +0200 |
| Subject | Re: mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rQ7Vv-7Qe-9@gated-at.bofh.it> |
| In reply to | #1434839 |
> Can you please fix your email client to _not_ send References: > and In-reply-to: headers when sending new patches? I prefer to associate some patches with previous relevant discussion directly. > Even better would be to use git send-email for these patches. This command can also support a parameter like "--thread", can't it? Would you like point any more views out about communication styles? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-07-01 18:30 +0200 |
| Subject | Re: mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rQ9uh-r2-1@gated-at.bofh.it> |
| In reply to | #1435388 |
On Fri, 2016-07-01 at 16:40 +0200, SF Markus Elfring wrote: > > > > Can you please fix your email client to _not_ send References: > > and In-reply-to: headers when sending new patches? > I prefer to associate some patches with previous relevant > discussion directly. > > > > > > Even better would be to use git send-email for these patches. > This command can also support a parameter like "--thread", can't it? yes, good to see you can read documentation. > Would you like point any more views out about communication styles? Actually, yes. Just because you've submitted a similar patch, an independent patch like this one, doesn't need to refer to those patches you've previously submitted. For instance, your "References:" for this email imply some association to a patch series you submitted "[PATCH v3 0/3] gianfar: Fine-tuning for gfar_ethflow_to_filer_table()" for no obvious reason. What is this reason?
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-07-01 11:20 +0200 |
| Subject | Re: [PATCH] mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rQ2M9-4Op-23@gated-at.bofh.it> |
| In reply to | #1434830 |
On Thu, 30 Jun 2016, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 30 Jun 2016 21:54:51 +0200
>
> Adjust jump targets according to the Linux coding style convention.
> Another check for the variable "status" can be omitted then at the end.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mfd/dm355evm_msp.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
FYI, code looks fine.
... but please take this opportunity to set-up your submission
environment i.e. using `git format-patch` and `git send-email`. Once
you've done that, please re-submit this patch with my:
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
> index 270e19c..86eca61 100644
> --- a/drivers/mfd/dm355evm_msp.c
> +++ b/drivers/mfd/dm355evm_msp.c
> @@ -209,7 +209,7 @@ static struct device *add_child(struct i2c_client *client, const char *name,
> status = platform_device_add_data(pdev, pdata, pdata_len);
> if (status < 0) {
> dev_dbg(&pdev->dev, "can't add platform_data\n");
> - goto err;
> + goto put_device;
> }
> }
>
> @@ -222,19 +222,20 @@ static struct device *add_child(struct i2c_client *client, const char *name,
> status = platform_device_add_resources(pdev, &r, 1);
> if (status < 0) {
> dev_dbg(&pdev->dev, "can't add irq\n");
> - goto err;
> + goto put_device;
> }
> }
>
> status = platform_device_add(pdev);
> + if (status)
> + goto put_device;
>
> -err:
> - if (status < 0) {
> - platform_device_put(pdev);
> - dev_err(&client->dev, "can't add %s dev\n", name);
> - return ERR_PTR(status);
> - }
> return &pdev->dev;
> +
> +put_device:
> + platform_device_put(pdev);
> + dev_err(&client->dev, "failed to add device %s\n", name);
> + return ERR_PTR(status);
> }
>
> static int add_children(struct i2c_client *client)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-07-01 17:00 +0200 |
| Subject | Re: mfd: dm355evm_msp: Refactoring for add_child() |
| Message-ID | <rQ85c-7Ty-11@gated-at.bofh.it> |
| In reply to | #1435184 |
> FYI, code looks fine. Thanks for your acknowledgement. > ... but please take this opportunity to set-up your submission > environment i.e. using `git format-patch` and `git send-email`. Would you like to see any special settings to be mentioned in a section like "15) Explicit In-Reply-To headers" from the document "SubmittingPatches"? > you've done that, please re-submit this patch with my: Does the association of this patch with a bit relevant discussion really hinder the desired commit? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-26 16:00 +0200 |
| Subject | [PATCH 6/6] mfd: smsc-ece1099: Return directly after a function failure in smsc_i2c_probe() |
| Message-ID | <rOiLo-3E7-11@gated-at.bofh.it> |
| In reply to | #1431499 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 14:30:46 +0200
This issue was detected by using the Coccinelle software.
Return directly if a call of the function "devm_regmap_init_i2c"
or "regmap_write" failed.
Delete the jump label "err" then.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mfd/smsc-ece1099.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
index 2aaf89f..cd18c09 100644
--- a/drivers/mfd/smsc-ece1099.c
+++ b/drivers/mfd/smsc-ece1099.c
@@ -46,10 +46,8 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
}
smsc->regmap = devm_regmap_init_i2c(i2c, &smsc_regmap_config);
- if (IS_ERR(smsc->regmap)) {
- ret = PTR_ERR(smsc->regmap);
- goto err;
- }
+ if (IS_ERR(smsc->regmap))
+ return PTR_ERR(smsc->regmap);
i2c_set_clientdata(i2c, smsc);
smsc->dev = &i2c->dev;
@@ -68,7 +66,7 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
ret = regmap_write(smsc->regmap, SMSC_CLK_CTRL, smsc->clk);
if (ret)
- goto err;
+ return ret;
#ifdef CONFIG_OF
if (i2c->dev.of_node)
@@ -76,7 +74,6 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
NULL, NULL, &i2c->dev);
#endif
-err:
return ret;
}
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-06-28 17:10 +0200 |
| Message-ID | <rP2Od-hD-7@gated-at.bofh.it> |
| In reply to | #1431499 |
On Sun, 26 Jun 2016, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 26 Jun 2016 15:25:43 +0200 > > Several update suggestions were taken into account > from static source code analysis. > > Markus Elfring (6): > twl-core: Return directly after a failed platform_device_alloc() > in add_numbered_child() > twl-core: Refactoring for add_numbered_child() > dm355evm_msp: Return directly after a failed platform_device_alloc() > in add_child() > dm355evm_msp: Refactoring for add_child() > smsc-ece1099: Delete an unnecessary variable initialisation > in smsc_i2c_probe() > smsc-ece1099: Return directly after a function failure > in smsc_i2c_probe() > > drivers/mfd/dm355evm_msp.c | 25 ++++++++++++------------- > drivers/mfd/smsc-ece1099.c | 11 ++++------- > drivers/mfd/twl-core.c | 28 +++++++++++++--------------- > 3 files changed, 29 insertions(+), 35 deletions(-) What is this set? A different but related one to the set you tagged it on to? Probably best not to do that. I now have a huge entangled thread in my inbox, which is going to become out of control rather quickly (if it isn't already). -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web