Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1305951 > unrolled thread
| Started by | Lee Jones <lee.jones@linaro.org> |
|---|---|
| First post | 2016-01-11 09:40 +0100 |
| Last post | 2016-01-12 13:00 +0100 |
| Articles | 5 — 2 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.
Re: [PATCH] mfd-dm355evm_msp: One function call less in add_child() after error detection Lee Jones <lee.jones@linaro.org> - 2016-01-11 09:40 +0100
Re: mfd-dm355evm_msp: One function call less in add_child() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-12 09:40 +0100
Re: mfd-dm355evm_msp: One function call less in add_child() after error detection Lee Jones <lee.jones@linaro.org> - 2016-01-12 10:10 +0100
Re: mfd-dm355evm_msp: One function call less in add_child() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-12 12:50 +0100
Re: mfd-dm355evm_msp: One function call less in add_child() after error detection Lee Jones <lee.jones@linaro.org> - 2016-01-12 13:00 +0100
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-01-11 09:40 +0100 |
| Subject | Re: [PATCH] mfd-dm355evm_msp: One function call less in add_child() after error detection |
| Message-ID | <qPGb8-8fa-21@gated-at.bofh.it> |
On Tue, 29 Dec 2015, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 29 Dec 2015 13:56:42 +0100
>
> 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.
>
> Implementation details could be improved by the adjustment of jump targets
> according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mfd/dm355evm_msp.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
Same comments as before.
> diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
> index bc90efe..e4aa1b8 100644
> --- a/drivers/mfd/dm355evm_msp.c
> +++ b/drivers/mfd/dm355evm_msp.c
> @@ -202,7 +202,7 @@ static struct device *add_child(struct i2c_client *client, const char *name,
> if (!pdev) {
> dev_dbg(&client->dev, "can't alloc dev\n");
> status = -ENOMEM;
> - goto err;
> + goto report_failure;
> }
>
> device_init_wakeup(&pdev->dev, can_wakeup);
> @@ -212,7 +212,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;
> }
> }
>
> @@ -225,19 +225,18 @@ 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);
> - }
> - return &pdev->dev;
> + if (!status)
> + return &pdev->dev;
> +put_device:
> + platform_device_put(pdev);
> +report_failure:
> + dev_err(&client->dev, "can't add %s dev\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] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-01-12 09:40 +0100 |
| Subject | Re: mfd-dm355evm_msp: One function call less in add_child() after error detection |
| Message-ID | <qQ2EG-6Ka-5@gated-at.bofh.it> |
| In reply to | #1305951 |
>> 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. >> >> Implementation details could be improved by the adjustment of jump targets >> according to the Linux coding style convention. >> >> This issue was detected by using the Coccinelle software. >> >> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> >> --- >> drivers/mfd/dm355evm_msp.c | 21 ++++++++++----------- >> 1 file changed, 10 insertions(+), 11 deletions(-) > > Same comments as before. To which comments do you refer here? Are you interested in any further clarification of open issues? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-01-12 10:10 +0100 |
| Subject | Re: mfd-dm355evm_msp: One function call less in add_child() after error detection |
| Message-ID | <qQ37I-7fJ-3@gated-at.bofh.it> |
| In reply to | #1307096 |
On Tue, 12 Jan 2016, SF Markus Elfring wrote: > >> 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. > >> > >> Implementation details could be improved by the adjustment of jump targets > >> according to the Linux coding style convention. > >> > >> This issue was detected by using the Coccinelle software. > >> > >> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > >> --- > >> drivers/mfd/dm355evm_msp.c | 21 ++++++++++----------- > >> 1 file changed, 10 insertions(+), 11 deletions(-) > > > > Same comments as before. > > To which comments do you refer here? > > Are you interested in any further clarification of open issues? I'm sure you'll work it out. ;) -- 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-01-12 12:50 +0100 |
| Subject | Re: mfd-dm355evm_msp: One function call less in add_child() after error detection |
| Message-ID | <qQ5Cy-jP-11@gated-at.bofh.it> |
| In reply to | #1307126 |
> I'm sure you'll work it out. ;) Do you want any changes for this suggestion around the software component "dm355evm_msp"? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-01-12 13:00 +0100 |
| Subject | Re: mfd-dm355evm_msp: One function call less in add_child() after error detection |
| Message-ID | <qQ5Mf-nk-33@gated-at.bofh.it> |
| In reply to | #1307310 |
On Tue, 12 Jan 2016, SF Markus Elfring wrote: > > I'm sure you'll work it out. ;) > > Do you want any changes for this suggestion around the software > component "dm355evm_msp"? There we go. I have been more explicit as there was obviously some confusion. -- 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