Skip to content

Commit

Permalink
maiblox: mediatek: Fix handling of platform_get_irq() error
Browse files Browse the repository at this point in the history
platform_get_irq() returns -ERRNO on error.  In such case casting to u32
and comparing to 0 would pass the check.

Fixes: 623a614 ("mailbox: mediatek: Add Mediatek CMDQ driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
  • Loading branch information
krzk authored and JassiBrar committed Oct 13, 2020
1 parent 7002ca2 commit 558e4c3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/mailbox/mtk-cmdq-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 558e4c3

Please sign in to comment.