* [PATCH v2] media: imx-pxp: fix ERR_PTR dereference in pxp_probe()
@ 2024-05-14 9:50 Harshit Mogalapalli
2024-05-14 14:58 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Harshit Mogalapalli @ 2024-05-14 9:50 UTC (permalink / raw
To: Philipp Zabel, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Michael Tretter,
Laurent Pinchart, linux-media, imx, linux-arm-kernel,
linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
devm_regmap_init_mmio() can fail, add a check and bail out in case of
error.
Fixes: 4e5bd3fdbeb3 ("media: imx-pxp: convert to regmap")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis and only compile tested.
v1->v2: fix error message, we dont need %d in dev_err_probe()
---
drivers/media/platform/nxp/imx-pxp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c
index e62dc5c1a4ae..e4427e6487fb 100644
--- a/drivers/media/platform/nxp/imx-pxp.c
+++ b/drivers/media/platform/nxp/imx-pxp.c
@@ -1805,6 +1805,9 @@ static int pxp_probe(struct platform_device *pdev)
return PTR_ERR(mmio);
dev->regmap = devm_regmap_init_mmio(&pdev->dev, mmio,
&pxp_regmap_config);
+ if (IS_ERR(dev->regmap))
+ return dev_err_probe(&pdev->dev, PTR_ERR(dev->regmap),
+ "Failed to init regmap\n");
irq = platform_get_irq(pdev, 0);
if (irq < 0)
--
2.39.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] media: imx-pxp: fix ERR_PTR dereference in pxp_probe()
2024-05-14 9:50 [PATCH v2] media: imx-pxp: fix ERR_PTR dereference in pxp_probe() Harshit Mogalapalli
@ 2024-05-14 14:58 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2024-05-14 14:58 UTC (permalink / raw
To: Harshit Mogalapalli
Cc: Philipp Zabel, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Michael Tretter,
linux-media, imx, linux-arm-kernel, linux-kernel, dan.carpenter,
kernel-janitors, error27
Hi Harshit,
Thank you for the patch.
On Tue, May 14, 2024 at 02:50:38AM -0700, Harshit Mogalapalli wrote:
> devm_regmap_init_mmio() can fail, add a check and bail out in case of
> error.
>
> Fixes: 4e5bd3fdbeb3 ("media: imx-pxp: convert to regmap")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> This is based on static analysis and only compile tested.
> v1->v2: fix error message, we dont need %d in dev_err_probe()
> ---
> drivers/media/platform/nxp/imx-pxp.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c
> index e62dc5c1a4ae..e4427e6487fb 100644
> --- a/drivers/media/platform/nxp/imx-pxp.c
> +++ b/drivers/media/platform/nxp/imx-pxp.c
> @@ -1805,6 +1805,9 @@ static int pxp_probe(struct platform_device *pdev)
> return PTR_ERR(mmio);
> dev->regmap = devm_regmap_init_mmio(&pdev->dev, mmio,
> &pxp_regmap_config);
> + if (IS_ERR(dev->regmap))
> + return dev_err_probe(&pdev->dev, PTR_ERR(dev->regmap),
> + "Failed to init regmap\n");
>
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-14 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-14 9:50 [PATCH v2] media: imx-pxp: fix ERR_PTR dereference in pxp_probe() Harshit Mogalapalli
2024-05-14 14:58 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).