@@ -1765,6 +1765,10 @@ static int exynos_dsi_probe(struct platform_device *pdev)
dsi->dev = dev;
dsi->driver_data = of_device_get_match_data(dev);
+ if (!dsi->driver_data) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
ret = exynos_dsi_parse_dt(dsi);
if (ret)
@@ -1076,6 +1076,10 @@ static int fimd_probe(struct platform_device *pdev)
ctx->dev = dev;
ctx->suspended = true;
ctx->driver_data = of_device_get_match_data(dev);
+ if (!ctx->driver_data) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
if (of_property_read_bool(dev->of_node, "samsung,invert-vden"))
ctx->vidcon1 |= VIDCON1_INV_VDEN;
@@ -1837,6 +1837,10 @@ static int hdmi_probe(struct platform_device *pdev)
return -ENOMEM;
hdata->drv_data = of_device_get_match_data(dev);
+ if (!hdata->drv_data) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
platform_set_drvdata(pdev, hdata);
@@ -1205,6 +1205,10 @@ static int mixer_probe(struct platform_device *pdev)
}
drv = of_device_get_match_data(dev);
+ if (!drv) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
ctx->pdev = pdev;
ctx->dev = dev;
of_device_get_match_data could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++++ 4 files changed, 16 insertions(+)