pinctrl-st: fix of_irq_to_resource() result check
diff mbox

Message ID 20170729180744.873303067@cogentembedded.com
State New
Headers show

Commit Message

Sergei Shtylyov July 29, 2017, 6:07 p.m. UTC
of_irq_to_resource() has recently been fixed to return negative error #'s
along with 0 in case of failure, however the ST driver still only regards
0 as failure indication -- fix it up.

Fixes: 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/pinctrl/pinctrl-st.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sergei Shtylyov July 29, 2017, 7:15 p.m. UTC | #1
On 07/29/2017 09:07 PM, Sergei Shtylyov wrote:

> of_irq_to_resource() has recently been fixed to return negative error #'s
> along with 0 in case of failure, however the ST driver still only regards
> 0 as failure indication -- fix it up.
>
> Fixes: 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[...]

    Forgot to mention that the patch is against the 'fixes' branch of Linus 
W.'s 'linux-pinctrl.git' repo.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding July 31, 2017, 11:27 a.m. UTC | #2
On Sat, Jul 29, 2017 at 09:07:07PM +0300, Sergei Shtylyov wrote:
> of_irq_to_resource() has recently been fixed to return negative error #'s
> along with 0 in case of failure, however the ST driver still only regards
> 0 as failure indication -- fix it up.
> 
> Fixes: 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> ---
>  drivers/pinctrl/pinctrl-st.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-pinctrl/drivers/pinctrl/pinctrl-st.c
> ===================================================================
> --- linux-pinctrl.orig/drivers/pinctrl/pinctrl-st.c
> +++ linux-pinctrl/drivers/pinctrl/pinctrl-st.c
> @@ -1521,7 +1521,7 @@ static int st_gpiolib_register_bank(stru
>  	 *	[irqN]----> [gpio-bank (n)]
>  	 */
>  
> -	if (of_irq_to_resource(np, 0, &irq_res)) {
> +	if (of_irq_to_resource(np, 0, &irq_res) > 0) {
>  		gpio_irq = irq_res.start;
>  		gpiochip_set_chained_irqchip(&bank->gpio_chip, &st_gpio_irqchip,
>  					     gpio_irq, st_gpio_irq_handler);

While at it, maybe turn this into of_irq_get() since you only need the
interrupt number in the first place?

Thierry
Sergei Shtylyov July 31, 2017, 11:56 a.m. UTC | #3
Hello!

On 07/31/2017 02:27 PM, Thierry Reding wrote:

>> of_irq_to_resource() has recently been fixed to return negative error #'s
>> along with 0 in case of failure, however the ST driver still only regards
>> 0 as failure indication -- fix it up.
>>
>> Fixes: 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
>> ---
>>  drivers/pinctrl/pinctrl-st.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Index: linux-pinctrl/drivers/pinctrl/pinctrl-st.c
>> ===================================================================
>> --- linux-pinctrl.orig/drivers/pinctrl/pinctrl-st.c
>> +++ linux-pinctrl/drivers/pinctrl/pinctrl-st.c
>> @@ -1521,7 +1521,7 @@ static int st_gpiolib_register_bank(stru
>>  	 *	[irqN]----> [gpio-bank (n)]
>>  	 */
>>
>> -	if (of_irq_to_resource(np, 0, &irq_res)) {
>> +	if (of_irq_to_resource(np, 0, &irq_res) > 0) {
>>  		gpio_irq = irq_res.start;
>>  		gpiochip_set_chained_irqchip(&bank->gpio_chip, &st_gpio_irqchip,
>>  					     gpio_irq, st_gpio_irq_handler);
>
> While at it, maybe turn this into of_irq_get() since you only need the
> interrupt number in the first place?

    Yeah, noticed that too. Will look into this (if I won't forget).

> Thierry

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Aug. 7, 2017, 9:05 a.m. UTC | #4
On Sat, Jul 29, 2017 at 8:07 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:

> of_irq_to_resource() has recently been fixed to return negative error #'s
> along with 0 in case of failure, however the ST driver still only regards
> 0 as failure indication -- fix it up.
>
> Fixes: 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Aug. 7, 2017, 9:56 a.m. UTC | #5
On 8/7/2017 12:05 PM, Linus Walleij wrote:

>> of_irq_to_resource() has recently been fixed to return negative error #'s
>> along with 0 in case of failure, however the ST driver still only regards
>> 0 as failure indication -- fix it up.
>>
>> Fixes: 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> Patch applied.

    Again, not seeing it...

> Yours,
> Linus Walleij

MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

Index: linux-pinctrl/drivers/pinctrl/pinctrl-st.c
===================================================================
--- linux-pinctrl.orig/drivers/pinctrl/pinctrl-st.c
+++ linux-pinctrl/drivers/pinctrl/pinctrl-st.c
@@ -1521,7 +1521,7 @@  static int st_gpiolib_register_bank(stru
 	 *	[irqN]----> [gpio-bank (n)]
 	 */
 
-	if (of_irq_to_resource(np, 0, &irq_res)) {
+	if (of_irq_to_resource(np, 0, &irq_res) > 0) {
 		gpio_irq = irq_res.start;
 		gpiochip_set_chained_irqchip(&bank->gpio_chip, &st_gpio_irqchip,
 					     gpio_irq, st_gpio_irq_handler);