Skip to contentSkip to conversation

drm: ARM HDLCD - fix an error code

PATCH In review Dan Carpenter 2 participants 2 messages Apr 2, 2016 – Apr 4, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: ARM HDLCD - fix an error code

We accidentally return PTR_ERR(NULL) which is success instead of a negative error code.

Fixes 879e40bea6f2 ('drm: ARM HDLCD - get rid of devm_clk_put()')
drivers/gpu/drm/arm/hdlcd_drv.c +2 -1
index 734849f..3ac1ae4 100644
@@ -55,8 +55,9 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 	hdlcd->mmio = devm_ioremap_resource(drm->dev, res);
 	if (IS_ERR(hdlcd->mmio)) {
 		DRM_ERROR("failed to map control registers area\n");
+		ret = PTR_ERR(hdlcd->mmio);
 		hdlcd->mmio = NULL;
-		return PTR_ERR(hdlcd->mmio);
+		return ret;
 	}
 
 	version = hdlcd_read(hdlcd, HDLCD_REG_VERSION);
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

We accidentally return PTR_ERR(NULL) which is success instead of a negative error code.

Fixes 879e40bea6f2 ('drm: ARM HDLCD - get rid of devm_clk_put()')
drivers/gpu/drm/arm/hdlcd_drv.c +0 -0
index 734849f..3ac1ae4 100644

drivers/gpu/drm/arm/hdlcd_drv.c static int hdlcd_load(struct drm_device *drm, unsigned long flags) · line 60

Quoted 7 lines
drivers/gpu/drm/arm/hdlcd_drv.c +2 -1
@@ -55,8 +55,9 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 	hdlcd->mmio = devm_ioremap_resource(drm->dev, res);
 	if (IS_ERR(hdlcd->mmio)) {
 		DRM_ERROR("failed to map control registers area\n");
+		ret = PTR_ERR(hdlcd->mmio);
 		hdlcd->mmio = NULL;
-		return PTR_ERR(hdlcd->mmio);
+		return ret;

Good catch, thanks for that!

I've pulled your patch and sent an updated pull request.

Best regards,
Liviu

Quoted 7 lines
drivers/gpu/drm/arm/hdlcd_drv.c +0 -0
 	}
 
 	version = hdlcd_read(hdlcd, HDLCD_REG_VERSION);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 8 lines
==========
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯