Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965139AbcKJVaY (ORCPT ); Thu, 10 Nov 2016 16:30:24 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:15540 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964864AbcKJVaX (ORCPT ); Thu, 10 Nov 2016 16:30:23 -0500 X-IronPort-AV: E=Sophos;i="5.31,620,1473112800"; d="scan'208";a="244557275" From: Julia Lawall To: Mark Yao Cc: kernel-janitors@vger.kernel.org, David Airlie , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Christophe JAILLET Subject: [PATCH] drm/rockchip: return ERR_PTR instead of NULL Date: Thu, 10 Nov 2016 22:10:56 +0100 Message-Id: <1478812256-26189-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 882 Lines: 26 rockchip_drm_framebuffer_init is only used in one case, in rockchip_drm_fbdev.c, where its return value is tested using IS_ERR. To enable propagating the reason for the error, change the definition so that it returns an ERR_PTR value. Problem found with the help of Coccinelle. Signed-off-by: Julia Lawall --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 0f6eda0..01e11bf 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -213,7 +213,7 @@ struct drm_framebuffer * rockchip_fb = rockchip_fb_alloc(dev, mode_cmd, &obj, 1); if (IS_ERR(rockchip_fb)) - return NULL; + return ERR_CAST(rockchip_fb); return &rockchip_fb->fb; }