1
0
Fork 0

maiblox: mediatek: Fix handling of platform_get_irq() error

[ Upstream commit 558e4c36ec ]

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

Fixes: 623a6143a8 ("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>
5.4-rM2-2.2.x-imx-squashed
Krzysztof Kozlowski 2020-08-27 09:31:28 +02:00 committed by Greg Kroah-Hartman
parent e7f0b9ab8b
commit 180cf2e5f7
1 changed files with 3 additions and 5 deletions

View File

@ -70,7 +70,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;
@ -474,10 +474,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);