From patchwork Sat Nov 5 05:48:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 9413383 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 E3EAB60573 for ; Fri, 4 Nov 2016 21:42:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D42202B1FC for ; Fri, 4 Nov 2016 21:42:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C86A32B207; Fri, 4 Nov 2016 21:42:10 +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=-2.3 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, 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 478BD2B1FC for ; Fri, 4 Nov 2016 21:42:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 473B16E0BD; Fri, 4 Nov 2016 21:42:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5FAE6E0BD for ; Fri, 4 Nov 2016 21:42:06 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 04 Nov 2016 14:42:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,445,1473145200"; d="scan'208";a="27947100" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga004.jf.intel.com with ESMTP; 04 Nov 2016 14:42:04 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1c2mGD-000QwA-TT; Sat, 05 Nov 2016 05:42:53 +0800 Date: Sat, 5 Nov 2016 13:48:50 +0800 From: kbuild test robot To: Junwei Zhang Subject: [PATCH] drm/amdgpu: fix alloc_cast.cocci warnings Message-ID: <20161105054850.GA44302@lkp-sb04.lkp.intel.com> References: <201611051347.acY9vBUP%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201611051347.acY9vBUP%fengguang.wu@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Cc: Alex Deucher , Monk Liu , kbuild-all@01.org, dri-devel@lists.freedesktop.org, Jammy Zhou 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 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1225:10-29: WARNING: casting value returned by memory allocation function to (struct dma_fence * *) is useless. Remove casting the values returned by memory allocation functions like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc. Semantic patch information: This makes an effort to find cases of casting of values returned by kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc, kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes the casting as it is not required. The result in the patch case may need some reformatting. Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci CC: Junwei Zhang Signed-off-by: Fengguang Wu --- amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1222,7 +1222,7 @@ static int amdgpu_cs_wait_any_fence(stru long r; /* Prepare the fence array */ - array = (struct dma_fence **)kcalloc(fence_count, sizeof(struct dma_fence *), + array = kcalloc(fence_count, sizeof(struct dma_fence *), GFP_KERNEL); if (array == NULL) return -ENOMEM;