MLK-14718 video: fbdev: mxc: mipi dsi: Check device tree node in probe
authorLiu Ying <victor.liu@nxp.com>
Thu, 20 Apr 2017 07:27:57 +0000 (15:27 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:22:01 +0000 (15:22 -0500)
For the safe probing's sake, check valid device tree node in probe function.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/video/fbdev/mxc/mipi_dsi.c

index 4e189cd..d0f064e 100644 (file)
@@ -839,6 +839,11 @@ static int mipi_dsi_probe(struct platform_device *pdev)
        int mux;
        int ret = 0;
 
+       if (!np) {
+               dev_err(&pdev->dev, "failed to find device tree node\n");
+               return -ENODEV;
+       }
+
        mipi_dsi = devm_kzalloc(&pdev->dev, sizeof(*mipi_dsi), GFP_KERNEL);
        if (!mipi_dsi)
                return -ENOMEM;