[PATCH] media: imx-jpeg: Fix Coverity issue in probe
From: Mirela Rabulea
Date: Sun Oct 16 2022 - 10:05:02 EST
Possible dereference null return after of_match_node,
so check for NULL of_id.
Signed-off-by: Mirela Rabulea <mirela.rabulea@xxxxxxxxxxx>
---
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
index 51a503f0a47b..9d0a361a94cb 100644
--- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
@@ -2432,6 +2432,8 @@ static int mxc_jpeg_probe(struct platform_device *pdev)
unsigned int slot;
of_id = of_match_node(mxc_jpeg_match, dev->of_node);
+ if (!of_id)
+ return -ENODEV;
mode = *(const int *)of_id->data;
jpeg = devm_kzalloc(dev, sizeof(struct mxc_jpeg_dev), GFP_KERNEL);
--
2.25.1