[Intel-gfx] [PATCH] drm/rcar-du: Fix error check when retrieving crtc state

Sean Paul sean at poorly.run
Mon Jun 17 18:15:42 UTC 2019


From: Sean Paul <seanpaul at chromium.org>

drm_atomic_get_crtc_state() returns an error pointer when it fails, so
the null check is doing nothing here.

Credit to 0-day/Dan Carpenter for reporting this.

Fixes: 6f3b62781bbd ("drm: Convert connector_helper_funcs->atomic_check to accept drm_atomic_state")
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Cc: Jani Nikula <jani.nikula at linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Ben Skeggs <bskeggs at redhat.com>
Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas at ideasonboard.com>
Cc: Eric Anholt <eric at anholt.net>
Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com> [for rcar lvds]
Cc: Sean Paul <seanpaul at chromium.org>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Maxime Ripard <maxime.ripard at bootlin.com>
Cc: Sean Paul <sean at poorly.run>
Cc: David Airlie <airlied at linux.ie>
Cc: Lyude Paul <lyude at redhat.com>
Cc: Karol Herbst <karolherbst at gmail.com>
Cc: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: dri-devel at lists.freedesktop.org
Cc: intel-gfx at lists.freedesktop.org
Cc: linux-renesas-soc at vger.kernel.org
Reported-by: kbuild test robot <lkp at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/rcar-du/rcar_lvds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index f2a5d4d997073..1c62578590f46 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -115,8 +115,8 @@ static int rcar_lvds_connector_atomic_check(struct drm_connector *connector,
 
 	/* We're not allowed to modify the resolution. */
 	crtc_state = drm_atomic_get_crtc_state(state, conn_state->crtc);
-	if (!crtc_state)
-		return -EINVAL;
+	if (IS_ERR(crtc_state))
+		return PTR_ERR(crtc_state);
 
 	if (crtc_state->mode.hdisplay != panel_mode->hdisplay ||
 	    crtc_state->mode.vdisplay != panel_mode->vdisplay)
-- 
Sean Paul, Software Engineer, Google / Chromium OS



More information about the Intel-gfx mailing list