diff mbox series

media: imx-jpeg: Fix Coverity issue in probe

Message ID 20221016135200.3406628-1-mirela.rabulea@oss.nxp.com
State Accepted
Commit c558f69c402c8847500f663c544d49e822b56a17
Headers show
Series media: imx-jpeg: Fix Coverity issue in probe | expand

Commit Message

Mirela Rabulea OSS Oct. 16, 2022, 1:52 p.m. UTC
Possible dereference null return after of_match_node,
so check for NULL of_id.

Signed-off-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com>
---
 drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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);