Skip to contentSkip to conversation

brcmfmac: fix error handling of irq_of_parse_and_map

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

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

PATCH 1/1 brcmfmac: 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/net/wireless/brcm80211/brcmfmac/of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/of.c +2 -2
index eb3fce82..c824570 100644
@@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
 		return;
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq < 0) {
-		brcmf_err("interrupt could not be mapped: err=%d\n", irq);
+	if (!irq) {
+		brcmf_err("interrupt could not be mapped\n");
 		devm_kfree(dev, sdiodev->pdata);
 		return;
 	}
Signature · 5 lines
2.1.0.rc2.206.gedb03e5


-- 
Dmitry
#1 lore raw
Quoted 2 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.

Whoops, that is bad. Thanks for catching this. It probably needs to go to stable as well for 3.17 kernel.

+Cc: [email protected] # v3.17 +Acked-by: Arend van Spriel <arend-dY08KVG/lbpWk0Htik3J/[email protected]>

Quoted 13 lines

---

Not tested, found by casual code inspection.

  drivers/net/wireless/brcm80211/brcmfmac/of.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/of.c +0 -0
index eb3fce82..c824570 100644

drivers/net/wireless/brcm80211/brcmfmac/of.c void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev) · line 47

Quoted 10 lines
drivers/net/wireless/brcm80211/brcmfmac/of.c +2 -2
@@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  		return;
 
  	irq = irq_of_parse_and_map(np, 0);
-	if (irq<  0) {
-		brcmf_err("interrupt could not be mapped: err=%d\n", irq);
+	if (!irq) {
+		brcmf_err("interrupt could not be mapped\n");
  		devm_kfree(dev, sdiodev->pdata);
  		return;
  	}

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html