From: Daniel Vetter Subject: [PATCH 05/13] drm/ast: Remove unnecessary NULL check in bo_unref Date: Sat, 5 Apr 2014 11:44:54 +0200 Message-ID: <1396691102-22904-7-git-send-email-daniel.vetter@ffwll.ch> References: <1396691102-22904-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 348EF6E1DD for ; Sat, 5 Apr 2014 02:45:17 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id x13so4463252wgg.26 for ; Sat, 05 Apr 2014 02:45:16 -0700 (PDT) In-Reply-To: <1396691102-22904-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: DRI Development Cc: Dave Jones , Daniel Vetter List-Id: dri-devel@lists.freedesktop.org ttm_bo_unref unconditionally calls kref_put on it's argument, so the thing can't be NULL without already causing Oopses. Spotted by coverity. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ast/ast_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 50535fd5a88d..38941a656312 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -411,10 +411,9 @@ static void ast_bo_unref(struct ast_bo **bo) tbo = &((*bo)->bo); ttm_bo_unref(&tbo); - if (tbo == NULL) - *bo = NULL; - + *bo = NULL; } + void ast_gem_free_object(struct drm_gem_object *obj) { struct ast_bo *ast_bo = gem_to_ast_bo(obj); -- 1.8.5.2