]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: omap3isp: Fix memleak in isp_probe
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 24 Aug 2020 06:53:52 +0000 (08:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:03:02 +0000 (09:03 +0100)
[ Upstream commit d8fc21c17099635e8ebd986d042be65a6c6b5bd0 ]

When devm_ioremap_resource() fails, isp should be
freed just like other error paths in isp_probe.

Fixes: 8644cdf972dd6 ("[media] omap3isp: Replace many MMIO regions by two")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/omap3isp/isp.c

index f41e0d08de93e6219bac147398eb6bf50b3409eb..4c6842202e47c281a8849a4736634ab5a3052d6c 100644 (file)
@@ -2388,8 +2388,10 @@ static int isp_probe(struct platform_device *pdev)
                mem = platform_get_resource(pdev, IORESOURCE_MEM, i);
                isp->mmio_base[map_idx] =
                        devm_ioremap_resource(isp->dev, mem);
-               if (IS_ERR(isp->mmio_base[map_idx]))
-                       return PTR_ERR(isp->mmio_base[map_idx]);
+               if (IS_ERR(isp->mmio_base[map_idx])) {
+                       ret = PTR_ERR(isp->mmio_base[map_idx]);
+                       goto error;
+               }
        }
 
        ret = isp_get_clocks(isp);