diff mbox

[v2] drm/i915: set "ret" correctly on error paths

Message ID 20170414195425.GA8144@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 14, 2017, 7:54 p.m. UTC
If "crtc" is NULL, then my static checker complains that "ret" isn't
initialized on that path.  It doesn't really cause a problem unless
"ret" is somehow set to -EDEADLK which is not likely.

Chris Wilson also noticed another error path where "ret" isn't set
correctly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Chris Wilson April 15, 2017, 9:32 a.m. UTC | #1
On Fri, Apr 14, 2017 at 10:54:25PM +0300, Dan Carpenter wrote:
> If "crtc" is NULL, then my static checker complains that "ret" isn't
> initialized on that path.  It doesn't really cause a problem unless
> "ret" is somehow set to -EDEADLK which is not likely.
> 
> Chris Wilson also noticed another error path where "ret" isn't set
> correctly.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Pushed, thanks very much for the patch.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 48a546210d8b..2c66de875d3d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9563,6 +9563,7 @@  int intel_get_load_detect_pipe(struct drm_connector *connector,
 	 */
 	if (!crtc) {
 		DRM_DEBUG_KMS("no pipe available for load-detect\n");
+		ret = -ENODEV;
 		goto fail;
 	}
 
@@ -9619,6 +9620,7 @@  int intel_get_load_detect_pipe(struct drm_connector *connector,
 		DRM_DEBUG_KMS("reusing fbdev for load-detection framebuffer\n");
 	if (IS_ERR(fb)) {
 		DRM_DEBUG_KMS("failed to allocate framebuffer for load-detection\n");
+		ret = PTR_ERR(fb);
 		goto fail;
 	}