Skip to contentSkip to conversation

maiblox: mediatek: Fix handling of platform_get_irq() error

PATCH Superseded Krzysztof Kozlowski 1 participant 2 messages Aug 27, 2020

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 maiblox: mediatek: Fix handling of platform_get_irq() error

platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.

Fixes 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
---
 drivers/mailbox/mtk-cmdq-mailbox.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +2 -4
index 484d4438cd83..76e4dfcf5228 100644
@@ -525,10 +525,8 @@ static int cmdq_probe(struct platform_device *pdev)
 	}
 
 	cmdq->irq = platform_get_irq(pdev, 0);
-	if (!cmdq->irq) {
-		dev_err(dev, "failed to get irq\n");
-		return -EINVAL;
-	}
+	if (!cmdq->irq < 0)
+		return cmdq->irq;
 
 	plat_data = (struct gce_plat *)of_device_get_match_data(dev);
 	if (!plat_data) {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 15 lines · Krzysztof Kozlowski

platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.

Fixes 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
---
 drivers/mailbox/mtk-cmdq-mailbox.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +0 -0
index 484d4438cd83..76e4dfcf5228 100644

drivers/mailbox/mtk-cmdq-mailbox.c static int cmdq_probe(struct platform_device *pdev) · line 528

Quoted 8 lines
drivers/mailbox/mtk-cmdq-mailbox.c +1 -4
@@ -525,10 +525,8 @@ static int cmdq_probe(struct platform_device *pdev)
        }
 
        cmdq->irq = platform_get_irq(pdev, 0);
-       if (!cmdq->irq) {
-               dev_err(dev, "failed to get irq\n");
-               return -EINVAL;
-       }
+       if (!cmdq->irq < 0)

Ah, this is wrong. The irq is u32... without my patch this was so broken...

Best regards,
Krzysztof