media: platform: Improve getting and requesting irq flow for bug fixing
authorXia Jiang <xia.jiang@mediatek.com>
Fri, 14 Aug 2020 07:11:36 +0000 (09:11 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 28 Aug 2020 13:18:31 +0000 (15:18 +0200)
Delete platform_get_resource operation for irq.
Return actual value rather than EINVAL when fail to get and request
irq.

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c

index 93347ab9b9533e0197ae1655eb8a379851fbde0e..f4264f429df9ec141b4f87fdbaf5fc89f87fda8a 100644 (file)
@@ -1103,12 +1103,10 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
                return ret;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        dec_irq = platform_get_irq(pdev, 0);
-       if (!res || dec_irq < 0) {
+       if (dec_irq < 0) {
                dev_err(&pdev->dev, "Failed to get dec_irq %d.\n", dec_irq);
-               ret = -EINVAL;
-               return ret;
+               return dec_irq;
        }
 
        ret = devm_request_irq(&pdev->dev, dec_irq, mtk_jpeg_dec_irq, 0,
@@ -1116,7 +1114,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
        if (ret) {
                dev_err(&pdev->dev, "Failed to request dec_irq %d (%d)\n",
                        dec_irq, ret);
-               ret = -EINVAL;
                goto err_req_irq;
        }