]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: coda/imx-vdoa: Check for platform_get_resource() error
authorFabio Estevam <fabio.estevam@nxp.com>
Thu, 17 Aug 2017 00:14:07 +0000 (20:14 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 20 Aug 2017 12:26:53 +0000 (08:26 -0400)
platform_get_resource() may fail and in this case a NULL dereference
will occur.

Prevent this from happening by returning an error on
platform_get_resource() failure.

Fixes: b0444f18e0b18abce ("[media] coda: add i.MX6 VDOA driver")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/coda/imx-vdoa.c

index df9b71621420cccd8712015d91d9e7d93424ba0d..8eb3e0c05473ada80a42cb8c7c0ccc4f8fd4cbb4 100644 (file)
@@ -314,6 +314,8 @@ static int vdoa_probe(struct platform_device *pdev)
                return PTR_ERR(vdoa->regs);
 
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (!res)
+               return -EINVAL;
        vdoa->irq = devm_request_threaded_irq(&pdev->dev, res->start, NULL,
                                        vdoa_irq_handler, IRQF_ONESHOT,
                                        "vdoa", vdoa);