]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfc: nfcmrvl: Fix irq_of_parse_and_map() return value
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Mon, 27 Jun 2022 12:40:48 +0000 (14:40 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 29 Jun 2022 04:27:53 +0000 (21:27 -0700)
The irq_of_parse_and_map() returns 0 on failure, not a negative ERRNO.

Reported-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Fixes: b73b9fb50f11 ("NFC: nfcmrvl: add spi driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220627124048.296253-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/nfc/nfcmrvl/i2c.c
drivers/nfc/nfcmrvl/spi.c

index ceef81d93ac997b0caba42a5d5122dbd29afa82c..01329b91d59d547577680a058bced7d001c6c364 100644 (file)
@@ -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;
 
index a38e2fcdfd39fc7270310636e4495462e1ba998d..ad3359a4942c7ce24d91d366463c42fff639935b 100644 (file)
@@ -115,9 +115,9 @@ static int nfcmrvl_spi_parse_dt(struct device_node *node,
        }
 
        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;