[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c63c2212-16d0-4d4b-9055-afc1196d7da1@amd.com>
Date: Fri, 31 May 2024 14:02:37 +0530
From: Vasant Hegde <vasant.hegde@....com>
To: Dan Carpenter <dan.carpenter@...aro.org>, oe-kbuild@...ts.linux.dev
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, Joerg Roedel <jroedel@...e.de>,
Jason Gunthorpe <jgg@...dia.com>
Subject: Re: drivers/iommu/amd/iommu.c:2011 init_gcr3_table() warn: missing
error code? 'ret'
Hi Dan,
On 5/23/2024 8:39 PM, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 29c73fc794c83505066ee6db893b2a83ac5fac63
> commit: c9e8701132e6cc162d082e7dad8a2e9110f5f8fd iommu/amd: Setup GCR3 table in advance if domain is SVA capable
> config: x86_64-randconfig-161-20240522 (https://download.01.org/0day-ci/archive/20240522/202405221116.X7cP3GzG-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> | Closes: https://lore.kernel.org/r/202405221116.X7cP3GzG-lkp@intel.com/
>
> smatch warnings:
> drivers/iommu/amd/iommu.c:2011 init_gcr3_table() warn: missing error code? 'ret'
>
> vim +/ret +2011 drivers/iommu/amd/iommu.c
>
> c9e8701132e6cc Vasant Hegde 2024-04-18 1986 static int init_gcr3_table(struct iommu_dev_data *dev_data,
> c9e8701132e6cc Vasant Hegde 2024-04-18 1987 struct protection_domain *pdom)
> c9e8701132e6cc Vasant Hegde 2024-04-18 1988 {
> c9e8701132e6cc Vasant Hegde 2024-04-18 1989 struct amd_iommu *iommu = get_amd_iommu_from_dev_data(dev_data);
> c9e8701132e6cc Vasant Hegde 2024-04-18 1990 int max_pasids = dev_data->max_pasids;
> c9e8701132e6cc Vasant Hegde 2024-04-18 1991 int ret = 0;
> c9e8701132e6cc Vasant Hegde 2024-04-18 1992
> c9e8701132e6cc Vasant Hegde 2024-04-18 1993 /*
> c9e8701132e6cc Vasant Hegde 2024-04-18 1994 * If domain is in pt mode then setup GCR3 table only if device
> c9e8701132e6cc Vasant Hegde 2024-04-18 1995 * is PASID capable
> c9e8701132e6cc Vasant Hegde 2024-04-18 1996 */
> c9e8701132e6cc Vasant Hegde 2024-04-18 1997 if (pdom_is_in_pt_mode(pdom) && !pdev_pasid_supported(dev_data))
> c9e8701132e6cc Vasant Hegde 2024-04-18 1998 return ret;
> c9e8701132e6cc Vasant Hegde 2024-04-18 1999
> c9e8701132e6cc Vasant Hegde 2024-04-18 2000 /*
> c9e8701132e6cc Vasant Hegde 2024-04-18 2001 * By default, setup GCR3 table to support MAX PASIDs
> c9e8701132e6cc Vasant Hegde 2024-04-18 2002 * supported by the device/IOMMU.
> c9e8701132e6cc Vasant Hegde 2024-04-18 2003 */
> c9e8701132e6cc Vasant Hegde 2024-04-18 2004 ret = setup_gcr3_table(&dev_data->gcr3_info, iommu,
> c9e8701132e6cc Vasant Hegde 2024-04-18 2005 max_pasids > 0 ? max_pasids : 1);
> c9e8701132e6cc Vasant Hegde 2024-04-18 2006 if (ret)
> c9e8701132e6cc Vasant Hegde 2024-04-18 2007 return ret;
> c9e8701132e6cc Vasant Hegde 2024-04-18 2008
> c9e8701132e6cc Vasant Hegde 2024-04-18 2009 /* Setup GCR3[0] only if domain is setup with v2 page table mode */
> c9e8701132e6cc Vasant Hegde 2024-04-18 2010 if (!pdom_is_v2_pgtbl_mode(pdom))
> c9e8701132e6cc Vasant Hegde 2024-04-18 @2011 return ret;
>
> From the comment, this looks like a false positive, but could you please
> change it to "return 0;"
ret is already zero. Hence I used 'ret'. Yeah . I can change this to zero.
-Vasant
Powered by blists - more mailing lists