2013-05-07 12:06:23

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH] pinctrl: single: fix error return code in pcs_parse_one_pinctrl_entry()

From: Wei Yongjun <[email protected]>

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Introduced by commit 9dddb4df90d136429b6d6ddefceb49a9b93f6cd1
(pinctrl: single: support generic pinconf)

Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/pinctrl/pinctrl-single.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 5f2d2bf..b9fa046 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1166,7 +1166,8 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
(*map)->data.mux.function = np->name;

if (pcs->is_pinconf) {
- if (pcs_parse_pinconf(pcs, np, function, map))
+ res = pcs_parse_pinconf(pcs, np, function, map);
+ if (res)
goto free_pingroups;
*num_maps = 2;
} else {


2013-05-07 12:11:17

by Haojian Zhuang

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: single: fix error return code in pcs_parse_one_pinctrl_entry()

On 7 May 2013 20:06, Wei Yongjun <[email protected]> wrote:
> From: Wei Yongjun <[email protected]>
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Introduced by commit 9dddb4df90d136429b6d6ddefceb49a9b93f6cd1
> (pinctrl: single: support generic pinconf)
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/pinctrl/pinctrl-single.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index 5f2d2bf..b9fa046 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -1166,7 +1166,8 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
> (*map)->data.mux.function = np->name;
>
> if (pcs->is_pinconf) {
> - if (pcs_parse_pinconf(pcs, np, function, map))
> + res = pcs_parse_pinconf(pcs, np, function, map);
> + if (res)
> goto free_pingroups;
> *num_maps = 2;
> } else {
>

It seems that you don't change anything. pcs_parse_pinconf() returns
either 0 or negative value.

If it returns negative value, it will goto free_pingroups label w/wo
your change. So I don't understand why your change is necessary.

2013-05-07 12:57:51

by Wei Yongjun

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: single: fix error return code in pcs_parse_one_pinctrl_entry()

On 05/07/2013 08:11 PM, Haojian Zhuang wrote:
> On 7 May 2013 20:06, Wei Yongjun <[email protected]> wrote:
>> From: Wei Yongjun <[email protected]>
>>
>> Fix to return a negative error code from the error handling
>> case instead of 0, as done elsewhere in this function.
>>
>> Introduced by commit 9dddb4df90d136429b6d6ddefceb49a9b93f6cd1
>> (pinctrl: single: support generic pinconf)
>>
>> Signed-off-by: Wei Yongjun <[email protected]>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
>> index 5f2d2bf..b9fa046 100644
>> --- a/drivers/pinctrl/pinctrl-single.c
>> +++ b/drivers/pinctrl/pinctrl-single.c
>> @@ -1166,7 +1166,8 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
>> (*map)->data.mux.function = np->name;
>>
>> if (pcs->is_pinconf) {
>> - if (pcs_parse_pinconf(pcs, np, function, map))
>> + res = pcs_parse_pinconf(pcs, np, function, map);
>> + if (res)
>> goto free_pingroups;
>> *num_maps = 2;
>> } else {
>>
> It seems that you don't change anything. pcs_parse_pinconf() returns
> either 0 or negative value.
>
> If it returns negative value, it will goto free_pingroups label w/wo
> your change. So I don't understand why your change is necessary.

return res as the error code. before this change, 0 will be return
in this case.

2013-05-07 13:30:33

by Haojian Zhuang

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: single: fix error return code in pcs_parse_one_pinctrl_entry()

On 7 May 2013 20:57, Wei Yongjun <[email protected]> wrote:
> On 05/07/2013 08:11 PM, Haojian Zhuang wrote:
>> On 7 May 2013 20:06, Wei Yongjun <[email protected]> wrote:
>>> From: Wei Yongjun <[email protected]>
>>>
>>> Fix to return a negative error code from the error handling
>>> case instead of 0, as done elsewhere in this function.
>>>
>>> Introduced by commit 9dddb4df90d136429b6d6ddefceb49a9b93f6cd1
>>> (pinctrl: single: support generic pinconf)
>>>
>>> Signed-off-by: Wei Yongjun <[email protected]>
>>> ---
>>> drivers/pinctrl/pinctrl-single.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
>>> index 5f2d2bf..b9fa046 100644
>>> --- a/drivers/pinctrl/pinctrl-single.c
>>> +++ b/drivers/pinctrl/pinctrl-single.c
>>> @@ -1166,7 +1166,8 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
>>> (*map)->data.mux.function = np->name;
>>>
>>> if (pcs->is_pinconf) {
>>> - if (pcs_parse_pinconf(pcs, np, function, map))
>>> + res = pcs_parse_pinconf(pcs, np, function, map);
>>> + if (res)
>>> goto free_pingroups;
>>> *num_maps = 2;
>>> } else {
>>>
>> It seems that you don't change anything. pcs_parse_pinconf() returns
>> either 0 or negative value.
>>
>> If it returns negative value, it will goto free_pingroups label w/wo
>> your change. So I don't understand why your change is necessary.
>
> return res as the error code. before this change, 0 will be return
> in this case.
>
>
Yes, I didn't return the error code.

Acked-by: Haojian Zhuang <[email protected]>

Regards
Haojian

2013-05-14 12:05:04

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: single: fix error return code in pcs_parse_one_pinctrl_entry()

On Tue, May 7, 2013 at 2:06 PM, Wei Yongjun <[email protected]> wrote:

> From: Wei Yongjun <[email protected]>
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Introduced by commit 9dddb4df90d136429b6d6ddefceb49a9b93f6cd1
> (pinctrl: single: support generic pinconf)
>
> Signed-off-by: Wei Yongjun <[email protected]>

Thanks, patch applied to fixes with Haojians ACK.

Yours,
Linus Walleij