]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
maiblox: mediatek: Fix handling of platform_get_irq() error
authorKrzysztof Kozlowski <krzk@kernel.org>
Thu, 27 Aug 2020 07:31:28 +0000 (09:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:02 +0000 (10:08 +0100)
[ Upstream commit 558e4c36ec9f2722af4fe8ef84dc812bcdb5c43a ]

platform_get_irq() returns -ERRNO on error.  In such case casting to u32
and comparing to 0 would pass the check.

Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mailbox/mtk-cmdq-mailbox.c

index b24822ad8409ce391801f7274c70de18518748c6..9963bb9cd74fa13316191945162a79aed5ad841a 100644 (file)
@@ -69,7 +69,7 @@ struct cmdq_task {
 struct cmdq {
        struct mbox_controller  mbox;
        void __iomem            *base;
-       u32                     irq;
+       int                     irq;
        u32                     thread_nr;
        u32                     irq_mask;
        struct cmdq_thread      *thread;
@@ -466,10 +466,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;
 
        cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev);
        cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);