Skip to contentSkip to conversation

pinctrl: cy8c95x0: Use proper error code

PATCH In review Ethan Tidmore 2 participants 3 messages Feb 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: cy8c95x0: Use proper error code

The function cy8c95x0_irq_pending() returns type bool not an error code.

Use error code -EIO if cy8c95x0_irq_pending() fails.

Detected by Smatch:
drivers/pinctrl/pinctrl-cy8c95x0.c:1303 cy8c95x0_irq_setup() warn:
passing positive error code '1' to 'dev_err_probe'

Fixes 014884732095b ("pinctrl: cy8c95x0: Unify messages with help of dev_err_probe()")
---
 drivers/pinctrl/pinctrl-cy8c95x0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +1 -1
index 0d295ebc33d1..5796ce516788 100644
@@ -1300,7 +1300,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)
 	/* Read IRQ status register to clear all pending interrupts */
 	ret = cy8c95x0_irq_pending(chip, pending_irqs);
 	if (ret)
-		return dev_err_probe(dev, ret, "failed to clear irq status register\n");
+		return dev_err_probe(dev, -EIO, "failed to clear irq status register\n");
 
 	/* Mask all interrupts */
 	bitmap_fill(chip->irq_mask, MAX_LINE);
Signature · 1 line
2.53.0
#1 lore raw
Quoted 7 lines · Ethan Tidmore

The function cy8c95x0_irq_pending() returns type bool not an error code.

Use error code -EIO if cy8c95x0_irq_pending() fails.

Detected by Smatch:
drivers/pinctrl/pinctrl-cy8c95x0.c:1303 cy8c95x0_irq_setup() warn:
passing positive error code '1' to 'dev_err_probe'

I sent already a patch and the code is -EBUSY, because if we ever get non-zero here, it means that IO was fine, the interrupt status was not cleared.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 7 lines · Ethan Tidmore

The function cy8c95x0_irq_pending() returns type bool not an error code.

Use error code -EIO if cy8c95x0_irq_pending() fails.

Detected by Smatch:
drivers/pinctrl/pinctrl-cy8c95x0.c:1303 cy8c95x0_irq_setup() warn:
passing positive error code '1' to 'dev_err_probe'

I sent already a patch and the code is -EBUSY, because if we ever get non-zero here, it means that IO was fine, the interrupt status was not cleared.

I should have checked lore before sending that one off. Thanks for the error code pointer too.

Thanks,

ET