From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A800FC433F5 for ; Sat, 20 Nov 2021 08:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237115AbhKTIhB (ORCPT ); Sat, 20 Nov 2021 03:37:01 -0500 Received: from mga12.intel.com ([192.55.52.136]:17859 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237033AbhKTIg6 (ORCPT ); Sat, 20 Nov 2021 03:36:58 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10173"; a="214573324" X-IronPort-AV: E=Sophos;i="5.87,250,1631602800"; d="scan'208";a="214573324" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2021 00:33:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,250,1631602800"; d="scan'208";a="673481767" Received: from lkp-server02.sh.intel.com (HELO c20d8bc80006) ([10.239.97.151]) by orsmga005.jf.intel.com with ESMTP; 20 Nov 2021 00:33:53 -0800 Received: from kbuild by c20d8bc80006 with local (Exim 4.92) (envelope-from ) id 1moLon-0005ZP-3L; Sat, 20 Nov 2021 08:33:53 +0000 Date: Sat, 20 Nov 2021 16:33:30 +0800 From: kernel test robot To: Andi Kleen Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Kuppuswamy Sathyanarayanan Subject: [PATCH] swiotlb: fix alloc_cast.cocci warnings Message-ID: <20211120083330.GA35664@bc04062c4578> References: <202111201604.OPINOlHY-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202111201604.OPINOlHY-lkp@intel.com> X-Patchwork-Hint: ignore User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: kernel test robot kernel/dma/swiotlb.c:389:15-33: WARNING: casting value returned by memory allocation function to (struct io_tlb_area *) 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 Fixes: 4529b5784c14 ("swiotlb: Split up single swiotlb lock") CC: Andi Kleen Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://github.com/intel/tdx.git guest head: 41fe88a1b3c28543f49fa6ed9e0e9b6650ed7614 commit: 4529b5784c141782c72ec9bd9a92df2b68cb7d45 [129/144] swiotlb: Split up single swiotlb lock :::::: branch date: 9 days ago :::::: commit date: 9 days ago swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -386,7 +386,7 @@ swiotlb_late_init_with_tbl(char *tlb, un return -ENOMEM; } - mem->areas = (struct io_tlb_area *)kcalloc(num_areas, + mem->areas = kcalloc(num_areas, sizeof(struct io_tlb_area), GFP_KERNEL); if (!mem->areas) {