diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 0d46178f0d89485417bf500bc52f1f970f9af799..df7a77d3eff84b769342f04114a31a040a843769 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -1042,8 +1042,23 @@ static int g2d_check_reg_offset(struct device *dev, int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, void *data, struct drm_file *file) { + struct drm_exynos_file_private *file_priv = file->driver_priv; + struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; + struct device *dev; + struct g2d_data *g2d; struct drm_exynos_g2d_get_ver *ver = data; + if (!g2d_priv) + return -ENODEV; + + dev = g2d_priv->dev; + if (!dev) + return -ENODEV; + + g2d = dev_get_drvdata(dev); + if (!g2d) + return -EFAULT; + ver->major = G2D_HW_MAJOR_VER; ver->minor = G2D_HW_MINOR_VER;