uio: pruss: fix to check return value of platform_get_irq() in pruss_probe()
authorZhang Shurong <zhang_shurong@foxmail.com>
Sat, 22 Jul 2023 15:29:51 +0000 (23:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Aug 2023 14:21:04 +0000 (16:21 +0200)
The platform_get_irq might be failed and return a negative result. So
there should have an error handling code.

Fixed this by adding an error handling code.

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Link: https://lore.kernel.org/r/tencent_8E383752B54E5BF860711E500AD8A8971208@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_pruss.c

index 83966db..122c38e 100644 (file)
@@ -175,8 +175,12 @@ static int pruss_probe(struct platform_device *pdev)
                goto err_free_ddr_vaddr;
        }
 
+       ret = platform_get_irq(pdev, 0);
+       if (ret < 0)
+               goto err_free_ddr_vaddr;
+
+       gdev->hostirq_start = ret;
        gdev->pintc_base = pdata->pintc_base;
-       gdev->hostirq_start = platform_get_irq(pdev, 0);
 
        for (cnt = 0, p = gdev->info; cnt < MAX_PRUSS_EVT; cnt++, p++) {
                p->mem[0].addr = regs_prussio->start;