Skip to contentSkip to conversation

HIS: nokia-modem: fix error handling of irq_of_parse_and_map

PATCH In review Dmitry Torokhov 3 participants 3 messages Nov 14, 2014 – Nov 16, 2014 HSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HIS: nokia-modem: fix error handling of irq_of_parse_and_map

Return value of irq_of_parse_and_map() is unsigned int, with 0 indicating failure, so testing for negative result never works.

---

Not tested, found by casual code inspection.

 drivers/hsi/clients/nokia-modem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hsi/clients/nokia-modem.c +2 -2
index e43c3c9..32cc9af 100644
@@ -164,9 +164,9 @@ static int nokia_modem_probe(struct device *dev)
 	dev_set_drvdata(dev, modem);
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq < 0) {
+	if (!irq) {
 		dev_err(dev, "Invalid rst_ind interrupt (%d)\n", irq);
-		return irq;
+		return -EINVAL;
 	}
 	modem->nokia_modem_rst_ind_irq = irq;
 	pflags = irq_get_trigger_type(irq);
Signature · 5 lines
2.1.0.rc2.206.gedb03e5


-- 
Dmitry
Acked-by
#2 lore raw
Quoted 8 lines · Sebastian Reichel
Quoted 4 lines · Dmitry Torokhov

Return value of irq_of_parse_and_map() is unsigned int, with 0 indicating failure, so testing for negative result never works.

https://git.kernel.org/cgit/linux/kernel/git/sre/linux-hsi.git/commit/?h=for-next&id=d95dc9e388104488d0f5a5969c435e601840da2e

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html