Message ID | 20220422084605.2775542-1-lv.ruyi@zte.com.cn (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | NFC: nfcmrvl: fix error check return value of irq_of_parse_and_map() | expand |
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
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 :/
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; }