From patchwork Wed Jun 7 08:17:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 9770853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6B56660350 for ; Wed, 7 Jun 2017 08:17:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50CFC284D4 for ; Wed, 7 Jun 2017 08:17:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 442DE284EE; Wed, 7 Jun 2017 08:17:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D75EF284D4 for ; Wed, 7 Jun 2017 08:17:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3873C6E206; Wed, 7 Jun 2017 08:17:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8436F6E206 for ; Wed, 7 Jun 2017 08:17:08 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.39,310,1493676000"; d="scan'208";a="277645633" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2017 10:17:06 +0200 Date: Wed, 7 Jun 2017 10:17:04 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: annwang Subject: [PATCH] drm/amd/amdkcl: fix drm-get-put.cocci warnings Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Cc: amd-gfx@lists.freedesktop.org, =?ISO-8859-15?Q?Nicolai_H=E4hnle?= , dri-devel@lists.freedesktop.org, Alex Deucher , kbuild-all@01.org, Junwei Zhang , Evan Quan , =?ISO-8859-15?Q?Christian_K=F6nig?= , Alex Xie X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference() and drm_*_unreference() helpers. Generated by: scripts/coccinelle/api/drm-get-put.cocci CC: annwang Signed-off-by: Julia Lawall Signed-off-by: Fengguang Wu --- tree: git://people.freedesktop.org/~agd5f/linux.git amd-mainline-hybrid-4.11 head: 7ccf5ab3da7a87288cc0fd11910b212e4ac154a6 commit: 67207f0941969278dd47e2549fae4fe5502183c1 [1119/1800] drm/amd/amdkcl: [4.7] fix dev->struct_mutex Please take the patch only if it's a positive warning. Thanks! amdgpu_gem.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -108,9 +108,9 @@ void amdgpu_gem_force_release(struct amd idr_for_each_entry(&file->object_idr, gobj, handle) { WARN_ONCE(1, "And also active allocations!\n"); #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) - drm_gem_object_unreference(gobj); + drm_gem_object_put(gobj); #else - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); #endif } idr_destroy(&file->object_idr); @@ -287,7 +287,7 @@ int amdgpu_gem_create_ioctl(struct drm_d r = drm_gem_handle_create(filp, gobj, &handle); /* drop reference from allocate - handle holds it now */ - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); if (r) return r; @@ -365,7 +365,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_ r = drm_gem_handle_create(filp, gobj, &handle); /* drop reference from allocate - handle holds it now */ - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); if (r) return r; @@ -379,7 +379,7 @@ unlock_mmap_sem: up_read(¤t->mm->mmap_sem); release_object: - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return r; } @@ -398,11 +398,11 @@ int amdgpu_mode_dumb_mmap(struct drm_fil robj = gem_to_amdgpu_bo(gobj); if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) || (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) { - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return -EPERM; } *offset_p = amdgpu_bo_mmap_offset(robj); - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return 0; } @@ -472,7 +472,7 @@ int amdgpu_gem_wait_idle_ioctl(struct dr } else r = ret; - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return r; } @@ -515,7 +515,7 @@ int amdgpu_gem_metadata_ioctl(struct drm unreserve: amdgpu_bo_unreserve(robj); out: - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return r; } @@ -686,7 +686,7 @@ error_backoff: ttm_eu_backoff_reservation(&ticket, &list); error_unref: - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return r; } @@ -748,7 +748,7 @@ int amdgpu_gem_op_ioctl(struct drm_devic } out: - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); return r; } @@ -776,7 +776,7 @@ int amdgpu_mode_dumb_create(struct drm_f r = drm_gem_handle_create(file_priv, gobj, &handle); /* drop reference from allocate - handle holds it now */ - drm_gem_object_unreference_unlocked(gobj); + drm_gem_object_put_unlocked(gobj); if (r) { return r; }