linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map()
@ 2022-04-22  8:46 cgel.zte
  2022-04-22 10:30 ` Krzysztof Kozlowski
  2022-04-22 23:09 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: cgel.zte @ 2022-04-22  8:46 UTC (permalink / raw)
  To: krzysztof.kozlowski, davem
  Cc: kuba, lv.ruyi, yashsri421, sameo, cuissard, netdev, linux-kernel,
	Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

The irq_of_parse_and_map() function returns 0 on failure, and does not
return an negative value.

Fixes: 	b5b3e23e4cac ("NFC: nfcmrvl: add i2c driver")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/nfc/nfcmrvl/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c
index ceef81d93ac9..7dcc97707363 100644
--- a/drivers/nfc/nfcmrvl/i2c.c
+++ b/drivers/nfc/nfcmrvl/i2c.c
@@ -167,7 +167,7 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node,
 		pdata->irq_polarity = IRQF_TRIGGER_RISING;
 
 	ret = irq_of_parse_and_map(node, 0);
-	if (ret < 0) {
+	if (!ret) {
 		pr_err("Unable to get irq, error: %d\n", ret);
 		return ret;
 	}
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map()
  2022-04-22  8:46 [PATCH] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map() cgel.zte
@ 2022-04-22 10:30 ` Krzysztof Kozlowski
  2022-04-22 23:09 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-22 10:30 UTC (permalink / raw)
  To: cgel.zte, davem
  Cc: kuba, lv.ruyi, yashsri421, sameo, cuissard, netdev, linux-kernel,
	Zeal Robot

On 22/04/2022 10:46, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> The irq_of_parse_and_map() function returns 0 on failure, and does not
> return an negative value.
> 
> Fixes: 	b5b3e23e4cac ("NFC: nfcmrvl: add i2c driver")

Some unneeded indentation above.

Except that:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>




Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map()
  2022-04-22  8:46 [PATCH] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map() cgel.zte
  2022-04-22 10:30 ` Krzysztof Kozlowski
@ 2022-04-22 23:09 ` Jakub Kicinski
  2022-04-24  2:57   ` [PATCH v2] " cgel.zte
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-04-22 23:09 UTC (permalink / raw)
  To: cgel.zte
  Cc: krzysztof.kozlowski, davem, lv.ruyi, yashsri421, sameo, cuissard,
	netdev, linux-kernel, Zeal Robot

On Fri, 22 Apr 2022 08:46:05 +0000 cgel.zte@gmail.com wrote:
> diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c
> index ceef81d93ac9..7dcc97707363 100644
> --- a/drivers/nfc/nfcmrvl/i2c.c
> +++ b/drivers/nfc/nfcmrvl/i2c.c
> @@ -167,7 +167,7 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node,
>  		pdata->irq_polarity = IRQF_TRIGGER_RISING;
>  
>  	ret = irq_of_parse_and_map(node, 0);
> -	if (ret < 0) {
> +	if (!ret) {
>  		pr_err("Unable to get irq, error: %d\n", ret);
>  		return ret;

If ret is guaranteed to be 0 in this branch now, why print it, 
and how is it okay to return it from this function on error?

The usual low quality patch from the CGEL team :/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map()
  2022-04-22 23:09 ` Jakub Kicinski
@ 2022-04-24  2:57   ` cgel.zte
  2022-04-24 10:46     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 5+ messages in thread
From: cgel.zte @ 2022-04-24  2:57 UTC (permalink / raw)
  To: kuba
  Cc: cgel.zte, cuissard, davem, krzysztof.kozlowski, linux-kernel,
	lv.ruyi, netdev, sameo, yashsri421, Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

The irq_of_parse_and_map() function returns 0 on failure, and does not
return an negative value.

Fixes: b5b3e23e4cac ("NFC: nfcmrvl: add i2c driver")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
v2: don't print ret, and return -EINVAL rather than 0
---
 drivers/nfc/nfcmrvl/i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c
index ceef81d93ac9..01329b91d59d 100644
--- a/drivers/nfc/nfcmrvl/i2c.c
+++ b/drivers/nfc/nfcmrvl/i2c.c
@@ -167,9 +167,9 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node,
 		pdata->irq_polarity = IRQF_TRIGGER_RISING;
 
 	ret = irq_of_parse_and_map(node, 0);
-	if (ret < 0) {
-		pr_err("Unable to get irq, error: %d\n", ret);
-		return ret;
+	if (!ret) {
+		pr_err("Unable to get irq\n");
+		return -EINVAL;
 	}
 	pdata->irq = ret;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map()
  2022-04-24  2:57   ` [PATCH v2] " cgel.zte
@ 2022-04-24 10:46     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-24 10:46 UTC (permalink / raw)
  To: cgel.zte, kuba
  Cc: cuissard, davem, linux-kernel, lv.ruyi, netdev, sameo,
	yashsri421, Zeal Robot

On 24/04/2022 04:57, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> The irq_of_parse_and_map() function returns 0 on failure, and does not
> return an negative value.
> 
> Fixes: b5b3e23e4cac ("NFC: nfcmrvl: add i2c driver")
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---
> v2: don't print ret, and return -EINVAL rather than 0
> ---
>  drivers/nfc/nfcmrvl/i2c.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

How about Jakub's idea of squashing here fix for SPI (correcting my
patch) with additional Fixes tag?

Fixes: caf6e49bf6d0 ("NFC: nfcmrvl: add spi driver")

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-24 10:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22  8:46 [PATCH] NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map() cgel.zte
2022-04-22 10:30 ` Krzysztof Kozlowski
2022-04-22 23:09 ` Jakub Kicinski
2022-04-24  2:57   ` [PATCH v2] " cgel.zte
2022-04-24 10:46     ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).