* [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
@ 2021-07-15 6:42 ` Zhen Lei
0 siblings, 0 replies; 8+ messages in thread
From: Zhen Lei @ 2021-07-15 6:42 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
Cc: Zhen Lei
Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
is the same as that returned in pcs_parse_pinconf().
In addition, I found the value of pcs->flags is not overwritten in
pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
check to the beginning of the function eliminates unnecessary rollback
operations.
Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index e3aa64798f7d..d8b4dc40f3c6 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1115,7 +1115,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
{
const char *name = "pinctrl-single,bits";
struct pcs_func_vals *vals;
- int rows, *pins, found = 0, res = -ENOMEM, i, fsel, gsel;
+ int rows, *pins, found = 0, res = -ENOMEM, i, fsel;
int npins_in_row;
struct pcs_function *function = NULL;
@@ -1125,6 +1125,11 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
return -EINVAL;
}
+ if (PCS_HAS_PINCONF) {
+ dev_err(pcs->dev, "pinconf not supported\n");
+ return -ENOTSUPP;
+ }
+
npins_in_row = pcs->width / pcs->bits_per_pin;
vals = devm_kzalloc(pcs->dev,
@@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
goto free_pins;
}
- gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
- if (gsel < 0) {
- res = gsel;
+ res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
+ if (res < 0)
goto free_function;
- }
(*map)->type = PIN_MAP_TYPE_MUX_GROUP;
(*map)->data.mux.group = np->name;
(*map)->data.mux.function = np->name;
- if (PCS_HAS_PINCONF) {
- dev_err(pcs->dev, "pinconf not supported\n");
- goto free_pingroups;
- }
-
*num_maps = 1;
mutex_unlock(&pcs->mutex);
return 0;
-free_pingroups:
- pinctrl_generic_remove_group(pcs->pctl, gsel);
- *num_maps = 1;
free_function:
pinmux_generic_remove_function(pcs->pctl, fsel);
free_pins:
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
@ 2021-07-15 6:42 ` Zhen Lei
0 siblings, 0 replies; 8+ messages in thread
From: Zhen Lei @ 2021-07-15 6:42 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
Cc: Zhen Lei
Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
is the same as that returned in pcs_parse_pinconf().
In addition, I found the value of pcs->flags is not overwritten in
pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
check to the beginning of the function eliminates unnecessary rollback
operations.
Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index e3aa64798f7d..d8b4dc40f3c6 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1115,7 +1115,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
{
const char *name = "pinctrl-single,bits";
struct pcs_func_vals *vals;
- int rows, *pins, found = 0, res = -ENOMEM, i, fsel, gsel;
+ int rows, *pins, found = 0, res = -ENOMEM, i, fsel;
int npins_in_row;
struct pcs_function *function = NULL;
@@ -1125,6 +1125,11 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
return -EINVAL;
}
+ if (PCS_HAS_PINCONF) {
+ dev_err(pcs->dev, "pinconf not supported\n");
+ return -ENOTSUPP;
+ }
+
npins_in_row = pcs->width / pcs->bits_per_pin;
vals = devm_kzalloc(pcs->dev,
@@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
goto free_pins;
}
- gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
- if (gsel < 0) {
- res = gsel;
+ res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
+ if (res < 0)
goto free_function;
- }
(*map)->type = PIN_MAP_TYPE_MUX_GROUP;
(*map)->data.mux.group = np->name;
(*map)->data.mux.function = np->name;
- if (PCS_HAS_PINCONF) {
- dev_err(pcs->dev, "pinconf not supported\n");
- goto free_pingroups;
- }
-
*num_maps = 1;
mutex_unlock(&pcs->mutex);
return 0;
-free_pingroups:
- pinctrl_generic_remove_group(pcs->pctl, gsel);
- *num_maps = 1;
free_function:
pinmux_generic_remove_function(pcs->pctl, fsel);
free_pins:
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
2021-07-15 6:42 ` Zhen Lei
@ 2021-07-15 11:49 ` weiyongjun (A)
-1 siblings, 0 replies; 8+ messages in thread
From: weiyongjun (A) @ 2021-07-15 11:49 UTC (permalink / raw)
To: Zhen Lei, Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
> Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
> is the same as that returned in pcs_parse_pinconf().
>
> In addition, I found the value of pcs->flags is not overwritten in
> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
> check to the beginning of the function eliminates unnecessary rollback
> operations.
>
> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
>
> npins_in_row = pcs->width / pcs->bits_per_pin;
>
> vals = devm_kzalloc(pcs->dev,
> @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
> goto free_pins;
> }
>
> - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
> - if (gsel < 0) {
> - res = gsel;
> + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
> + if (res < 0)
> goto free_function;
> - }
This change cause 'gsel' not set.
Do not mix this cleanup with bugfix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
@ 2021-07-15 11:49 ` weiyongjun (A)
0 siblings, 0 replies; 8+ messages in thread
From: weiyongjun (A) @ 2021-07-15 11:49 UTC (permalink / raw)
To: Zhen Lei, Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
> Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
> is the same as that returned in pcs_parse_pinconf().
>
> In addition, I found the value of pcs->flags is not overwritten in
> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
> check to the beginning of the function eliminates unnecessary rollback
> operations.
>
> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
>
> npins_in_row = pcs->width / pcs->bits_per_pin;
>
> vals = devm_kzalloc(pcs->dev,
> @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
> goto free_pins;
> }
>
> - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
> - if (gsel < 0) {
> - res = gsel;
> + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
> + if (res < 0)
> goto free_function;
> - }
This change cause 'gsel' not set.
Do not mix this cleanup with bugfix.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
2021-07-15 11:49 ` weiyongjun (A)
@ 2021-07-16 1:04 ` Leizhen (ThunderTown)
-1 siblings, 0 replies; 8+ messages in thread
From: Leizhen (ThunderTown) @ 2021-07-16 1:04 UTC (permalink / raw)
To: weiyongjun (A),
Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
On 2021/7/15 19:49, weiyongjun (A) wrote:
>> Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
>> is the same as that returned in pcs_parse_pinconf().
>>
>> In addition, I found the value of pcs->flags is not overwritten in
>> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
>> check to the beginning of the function eliminates unnecessary rollback
>> operations.
>>
>> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>>
>>
>> npins_in_row = pcs->width / pcs->bits_per_pin;
>> vals = devm_kzalloc(pcs->dev,
>> @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
>> goto free_pins;
>> }
>> - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> - if (gsel < 0) {
>> - res = gsel;
>> + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> + if (res < 0)
>> goto free_function;
>> - }
>
>
> This change cause 'gsel' not set.
>
> Do not mix this cleanup with bugfix.
gsel已经不需要了,已经被我删掉了
>
>
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
@ 2021-07-16 1:04 ` Leizhen (ThunderTown)
0 siblings, 0 replies; 8+ messages in thread
From: Leizhen (ThunderTown) @ 2021-07-16 1:04 UTC (permalink / raw)
To: weiyongjun (A),
Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
On 2021/7/15 19:49, weiyongjun (A) wrote:
>> Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
>> is the same as that returned in pcs_parse_pinconf().
>>
>> In addition, I found the value of pcs->flags is not overwritten in
>> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
>> check to the beginning of the function eliminates unnecessary rollback
>> operations.
>>
>> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>>
>>
>> npins_in_row = pcs->width / pcs->bits_per_pin;
>> vals = devm_kzalloc(pcs->dev,
>> @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
>> goto free_pins;
>> }
>> - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> - if (gsel < 0) {
>> - res = gsel;
>> + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> + if (res < 0)
>> goto free_function;
>> - }
>
>
> This change cause 'gsel' not set.
>
> Do not mix this cleanup with bugfix.
gsel已经不需要了,已经被我删掉了
>
>
>
> .
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
2021-07-15 11:49 ` weiyongjun (A)
@ 2021-07-16 1:17 ` Leizhen (ThunderTown)
-1 siblings, 0 replies; 8+ messages in thread
From: Leizhen (ThunderTown) @ 2021-07-16 1:17 UTC (permalink / raw)
To: weiyongjun (A),
Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
On 2021/7/15 19:49, weiyongjun (A) wrote:
>> Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
>> is the same as that returned in pcs_parse_pinconf().
>>
>> In addition, I found the value of pcs->flags is not overwritten in
>> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
>> check to the beginning of the function eliminates unnecessary rollback
>> operations.
>>
>> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>>
>>
>> npins_in_row = pcs->width / pcs->bits_per_pin;
>> vals = devm_kzalloc(pcs->dev,
>> @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
>> goto free_pins;
>> }
>> - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> - if (gsel < 0) {
>> - res = gsel;
>> + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> + if (res < 0)
>> goto free_function;
>> - }
>
>
> This change cause 'gsel' not set.
The local variable 'gsel' is no longer needed. I have deleted it.
>
> Do not mix this cleanup with bugfix.
Yes, it might be clearer.
>
>
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
@ 2021-07-16 1:17 ` Leizhen (ThunderTown)
0 siblings, 0 replies; 8+ messages in thread
From: Leizhen (ThunderTown) @ 2021-07-16 1:17 UTC (permalink / raw)
To: weiyongjun (A),
Tony Lindgren, Haojian Zhuang, Linus Walleij,
Manjunathappa Prakash, linux-arm-kernel, linux-omap, linux-gpio,
linux-kernel
On 2021/7/15 19:49, weiyongjun (A) wrote:
>> Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
>> is the same as that returned in pcs_parse_pinconf().
>>
>> In addition, I found the value of pcs->flags is not overwritten in
>> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
>> check to the beginning of the function eliminates unnecessary rollback
>> operations.
>>
>> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>>
>>
>> npins_in_row = pcs->width / pcs->bits_per_pin;
>> vals = devm_kzalloc(pcs->dev,
>> @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
>> goto free_pins;
>> }
>> - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> - if (gsel < 0) {
>> - res = gsel;
>> + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
>> + if (res < 0)
>> goto free_function;
>> - }
>
>
> This change cause 'gsel' not set.
The local variable 'gsel' is no longer needed. I have deleted it.
>
> Do not mix this cleanup with bugfix.
Yes, it might be clearer.
>
>
>
> .
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-07-16 1:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 6:42 [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() Zhen Lei
2021-07-15 6:42 ` Zhen Lei
2021-07-15 11:49 ` weiyongjun (A)
2021-07-15 11:49 ` weiyongjun (A)
2021-07-16 1:04 ` Leizhen (ThunderTown)
2021-07-16 1:04 ` Leizhen (ThunderTown)
2021-07-16 1:17 ` Leizhen (ThunderTown)
2021-07-16 1:17 ` Leizhen (ThunderTown)
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.