diff mbox

drm/edid: checking for NULL instead of IS_ERR

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

Commit Message

Dan Carpenter April 12, 2017, 8:33 a.m. UTC
drm_mode_create_tile_group() uses error pointers, it doesn't return
NULL.  I re-arranged it a tiny bit to be more clear.

Fixes: 40d9b043a89e ("drm/connector: store tile information from displayid (v3)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Daniel Vetter April 12, 2017, 9:01 a.m. UTC | #1
On Wed, Apr 12, 2017 at 11:33:50AM +0300, Dan Carpenter wrote:
> drm_mode_create_tile_group() uses error pointers, it doesn't return
> NULL.  I re-arranged it a tiny bit to be more clear.
> 
> Fixes: 40d9b043a89e ("drm/connector: store tile information from displayid (v3)")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

There's a second caller in msm, which is also broken. I feel like fixing
create_tile_group is easier (plus updating the docs).
-Daniel

> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index fad3d44e4642..c6bc21673885 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4522,9 +4522,9 @@ static int drm_parse_tiled_block(struct drm_connector *connector,
>  	tg = drm_mode_get_tile_group(connector->dev, tile->topology_id);
>  	if (!tg) {
>  		tg = drm_mode_create_tile_group(connector->dev, tile->topology_id);
> +		if (IS_ERR(tg))
> +			return PTR_ERR(tg);
>  	}
> -	if (!tg)
> -		return -ENOMEM;
>  
>  	if (connector->tile_group != tg) {
>  		/* if we haven't got a pointer,
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fad3d44e4642..c6bc21673885 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4522,9 +4522,9 @@  static int drm_parse_tiled_block(struct drm_connector *connector,
 	tg = drm_mode_get_tile_group(connector->dev, tile->topology_id);
 	if (!tg) {
 		tg = drm_mode_create_tile_group(connector->dev, tile->topology_id);
+		if (IS_ERR(tg))
+			return PTR_ERR(tg);
 	}
-	if (!tg)
-		return -ENOMEM;
 
 	if (connector->tile_group != tg) {
 		/* if we haven't got a pointer,