Skip to content

Commit 558e4c3

Browse files
krzkJassiBrar
authored andcommitted
maiblox: mediatek: Fix handling of platform_get_irq() error
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 <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 7002ca2 commit 558e4c3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/mailbox/mtk-cmdq-mailbox.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct cmdq_task {
6969
struct cmdq {
7070
struct mbox_controller mbox;
7171
void __iomem *base;
72-
u32 irq;
72+
int irq;
7373
u32 thread_nr;
7474
u32 irq_mask;
7575
struct cmdq_thread *thread;
@@ -525,10 +525,8 @@ static int cmdq_probe(struct platform_device *pdev)
525525
}
526526

527527
cmdq->irq = platform_get_irq(pdev, 0);
528-
if (!cmdq->irq) {
529-
dev_err(dev, "failed to get irq\n");
530-
return -EINVAL;
531-
}
528+
if (cmdq->irq < 0)
529+
return cmdq->irq;
532530

533531
plat_data = (struct gce_plat *)of_device_get_match_data(dev);
534532
if (!plat_data) {

0 commit comments

Comments
 (0)