media: imx-jpeg: Fix Coverity issue in probe
authorMirela Rabulea <mirela.rabulea@oss.nxp.com>
Sun, 16 Oct 2022 13:52:00 +0000 (16:52 +0300)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 24 Oct 2022 17:03:54 +0000 (19:03 +0200)
Possible dereference null return after of_match_node,
so check for NULL of_id.

Signed-off-by: Mirela Rabulea <mirela.rabulea@oss.nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c

index 32fd04a..f6e21cf 100644 (file)
@@ -2163,6 +2163,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);