iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
@ 2020-09-18  1:13 Yu Kuai
  2020-09-21 17:50 ` Will Deacon
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Yu Kuai @ 2020-09-18  1:13 UTC (permalink / raw)
  To: robdclark, will, joro
  Cc: yi.zhang, linux-arm-msm, linux-kernel, iommu, yukuai3, linux-arm-kernel

if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.

Fixes: e86d1aa8b60f ("iommu/arm-smmu: Move Arm SMMU drivers into their own subdirectory")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/iommu/arm/arm-smmu/qcom_iommu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index 9535a6af7553..7a9594d221e0 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -584,8 +584,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
 	 * index into qcom_iommu->ctxs:
 	 */
 	if (WARN_ON(asid < 1) ||
-	    WARN_ON(asid > qcom_iommu->num_ctxs))
+	    WARN_ON(asid > qcom_iommu->num_ctxs)) {
+		put_device(&iommu_pdev->dev);
 		return -EINVAL;
+	}
 
 	if (!dev_iommu_priv_get(dev)) {
 		dev_iommu_priv_set(dev, qcom_iommu);
@@ -595,6 +597,7 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
 		 * banks are ok, but multiple devices are not:
 		 */
 		if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
+			put_device(&iommu_pdev->dev);
 			return -EINVAL;
 	}
 
-- 
2.25.4

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-18  1:13 [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Yu Kuai
@ 2020-09-21 17:50 ` Will Deacon
  2020-09-21 18:27   ` Rob Clark
  2020-09-21 19:13 ` kernel test robot
  2020-09-23  4:32 ` kernel test robot
  2 siblings, 1 reply; 10+ messages in thread
From: Will Deacon @ 2020-09-21 17:50 UTC (permalink / raw)
  To: Yu Kuai; +Cc: yi.zhang, linux-arm-msm, iommu, linux-kernel, linux-arm-kernel

On Fri, Sep 18, 2020 at 09:13:57AM +0800, Yu Kuai wrote:
> if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling for this function implementation.
> 
> Fixes: e86d1aa8b60f ("iommu/arm-smmu: Move Arm SMMU drivers into their own subdirectory")

That's probably not accurate, in that this driver used to live under
drivers/iommu/ and assumedly had this bug there as well.

> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>  drivers/iommu/arm/arm-smmu/qcom_iommu.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

I guess Rob will pick this up.

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-21 17:50 ` Will Deacon
@ 2020-09-21 18:27   ` Rob Clark
  2020-09-21 18:33     ` Rob Clark
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Clark @ 2020-09-21 18:27 UTC (permalink / raw)
  To: Will Deacon
  Cc: yi.zhang, linux-arm-msm, Linux Kernel Mailing List,
	list@263.net:IOMMU DRIVERS
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>, ,
	Yu Kuai, moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Mon, Sep 21, 2020 at 10:50 AM Will Deacon <will@kernel.org> wrote:
>
> On Fri, Sep 18, 2020 at 09:13:57AM +0800, Yu Kuai wrote:
> > if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have
> > a corresponding put_device(). Thus add put_device() to fix the exception
> > handling for this function implementation.
> >
> > Fixes: e86d1aa8b60f ("iommu/arm-smmu: Move Arm SMMU drivers into their own subdirectory")
>
> That's probably not accurate, in that this driver used to live under
> drivers/iommu/ and assumedly had this bug there as well.
>
> > Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> > ---
> >  drivers/iommu/arm/arm-smmu/qcom_iommu.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
>
> I guess Rob will pick this up.

Probably overkill for me to send a pull req for a single patch, if you
want to pick it up:

Acked-by: Rob Clark <robdclark@gmail.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-21 18:27   ` Rob Clark
@ 2020-09-21 18:33     ` Rob Clark
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Clark @ 2020-09-21 18:33 UTC (permalink / raw)
  To: Will Deacon
  Cc: yi.zhang, linux-arm-msm, Linux Kernel Mailing List,
	list@263.net:IOMMU DRIVERS
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>, ,
	Yu Kuai, moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Mon, Sep 21, 2020 at 11:27 AM Rob Clark <robdclark@gmail.com> wrote:
>
> On Mon, Sep 21, 2020 at 10:50 AM Will Deacon <will@kernel.org> wrote:
> >
> > On Fri, Sep 18, 2020 at 09:13:57AM +0800, Yu Kuai wrote:
> > > if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have
> > > a corresponding put_device(). Thus add put_device() to fix the exception
> > > handling for this function implementation.
> > >
> > > Fixes: e86d1aa8b60f ("iommu/arm-smmu: Move Arm SMMU drivers into their own subdirectory")
> >
> > That's probably not accurate, in that this driver used to live under
> > drivers/iommu/ and assumedly had this bug there as well.
> >

and fwiw, that looks like it should be:

Fixes: 0ae349a0f33fb ("iommu/qcom: Add qcom_iommu")

> > > Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> > > ---
> > >  drivers/iommu/arm/arm-smmu/qcom_iommu.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > I guess Rob will pick this up.
>
> Probably overkill for me to send a pull req for a single patch, if you
> want to pick it up:
>
> Acked-by: Rob Clark <robdclark@gmail.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-18  1:13 [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Yu Kuai
  2020-09-21 17:50 ` Will Deacon
@ 2020-09-21 19:13 ` kernel test robot
  2020-09-21 20:45   ` Will Deacon
  2020-09-23  4:32 ` kernel test robot
  2 siblings, 1 reply; 10+ messages in thread
From: kernel test robot @ 2020-09-21 19:13 UTC (permalink / raw)
  To: Yu Kuai, robdclark, will, joro
  Cc: kbuild-all, yi.zhang, linux-arm-msm, linux-kernel,
	clang-built-linux, iommu, yukuai3, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 7310 bytes --]

Hi Yu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on linus/master v5.9-rc6 next-20200921]
[cannot apply to robclark/msm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: arm64-randconfig-r023-20200920 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4e8c028158b56d9c2142a62464e8e0686bde3584)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/iommu/arm/arm-smmu/qcom_iommu.c:601:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
                           return -EINVAL;
                           ^
   drivers/iommu/arm/arm-smmu/qcom_iommu.c:599:3: note: previous statement is here
                   if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
                   ^
   1 warning generated.

# https://github.com/0day-ci/linux/commit/2d982fb40897ad8088dd9dba06aee499f51c73ba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
git checkout 2d982fb40897ad8088dd9dba06aee499f51c73ba
vim +/if +601 drivers/iommu/arm/arm-smmu/qcom_iommu.c

0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  562  
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  563  static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  564  {
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  565  	struct qcom_iommu_dev *qcom_iommu;
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  566  	struct platform_device *iommu_pdev;
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  567  	unsigned asid = args->args[0];
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  568  
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  569  	if (args->args_count != 1) {
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  570  		dev_err(dev, "incorrect number of iommu params found for %s "
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  571  			"(found %d, expected 1)\n",
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  572  			args->np->full_name, args->args_count);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  573  		return -EINVAL;
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  574  	}
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  575  
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  576  	iommu_pdev = of_find_device_by_node(args->np);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  577  	if (WARN_ON(!iommu_pdev))
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  578  		return -EINVAL;
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  579  
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  580  	qcom_iommu = platform_get_drvdata(iommu_pdev);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  581  
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  582  	/* make sure the asid specified in dt is valid, so we don't have
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  583  	 * to sanity check this elsewhere, since 'asid - 1' is used to
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  584  	 * index into qcom_iommu->ctxs:
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  585  	 */
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  586  	if (WARN_ON(asid < 1) ||
2d982fb40897ad drivers/iommu/arm/arm-smmu/qcom_iommu.c Yu Kuai      2020-09-18  587  	    WARN_ON(asid > qcom_iommu->num_ctxs)) {
2d982fb40897ad drivers/iommu/arm/arm-smmu/qcom_iommu.c Yu Kuai      2020-09-18  588  		put_device(&iommu_pdev->dev);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  589  		return -EINVAL;
2d982fb40897ad drivers/iommu/arm/arm-smmu/qcom_iommu.c Yu Kuai      2020-09-18  590  	}
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  591  
09b5dfff9ad68f drivers/iommu/qcom_iommu.c              Joerg Roedel 2020-03-26  592  	if (!dev_iommu_priv_get(dev)) {
09b5dfff9ad68f drivers/iommu/qcom_iommu.c              Joerg Roedel 2020-03-26  593  		dev_iommu_priv_set(dev, qcom_iommu);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  594  	} else {
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  595  		/* make sure devices iommus dt node isn't referring to
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  596  		 * multiple different iommu devices.  Multiple context
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  597  		 * banks are ok, but multiple devices are not:
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  598  		 */
09b5dfff9ad68f drivers/iommu/qcom_iommu.c              Joerg Roedel 2020-03-26  599  		if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
2d982fb40897ad drivers/iommu/arm/arm-smmu/qcom_iommu.c Yu Kuai      2020-09-18  600  			put_device(&iommu_pdev->dev);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09 @601  			return -EINVAL;
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  602  	}
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  603  
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  604  	return iommu_fwspec_add_ids(dev, &asid, 1);
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  605  }
0ae349a0f33fb0 drivers/iommu/qcom_iommu.c              Rob Clark    2017-08-09  606  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 46967 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-21 19:13 ` kernel test robot
@ 2020-09-21 20:45   ` Will Deacon
  2020-09-28 23:08     ` Will Deacon
  0 siblings, 1 reply; 10+ messages in thread
From: Will Deacon @ 2020-09-21 20:45 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, yi.zhang, linux-arm-msm, iommu, linux-kernel,
	clang-built-linux, Yu Kuai, linux-arm-kernel

On Tue, Sep 22, 2020 at 03:13:53AM +0800, kernel test robot wrote:
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on iommu/next]
> [also build test WARNING on linus/master v5.9-rc6 next-20200921]
> [cannot apply to robclark/msm-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
> config: arm64-randconfig-r023-20200920 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4e8c028158b56d9c2142a62464e8e0686bde3584)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/iommu/arm/arm-smmu/qcom_iommu.c:601:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
>                            return -EINVAL;
>                            ^
>    drivers/iommu/arm/arm-smmu/qcom_iommu.c:599:3: note: previous statement is here
>                    if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))

Oh, this looks like a nasty bug. Seems we're missing some braces.

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-18  1:13 [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Yu Kuai
  2020-09-21 17:50 ` Will Deacon
  2020-09-21 19:13 ` kernel test robot
@ 2020-09-23  4:32 ` kernel test robot
  2 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-09-23  4:32 UTC (permalink / raw)
  To: Yu Kuai, robdclark, will, joro
  Cc: kbuild-all, yi.zhang, linux-arm-msm, linux-kernel, iommu,
	yukuai3, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3037 bytes --]

Hi Yu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on linus/master v5.9-rc6 next-20200922]
[cannot apply to robclark/msm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: arm64-randconfig-m031-20200923 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/arm64/include/asm/atomic.h:12,
                    from include/linux/atomic.h:7,
                    from drivers/iommu/arm/arm-smmu/qcom_iommu.c:9:
   drivers/iommu/arm/arm-smmu/qcom_iommu.c: In function 'qcom_iommu_of_xlate':
>> include/linux/compiler.h:56:23: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   drivers/iommu/arm/arm-smmu/qcom_iommu.c:599:3: note: in expansion of macro 'if'
     599 |   if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
         |   ^~
   drivers/iommu/arm/arm-smmu/qcom_iommu.c:601:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     601 |    return -EINVAL;
         |    ^~~~~~

# https://github.com/0day-ci/linux/commit/2d982fb40897ad8088dd9dba06aee499f51c73ba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
git checkout 2d982fb40897ad8088dd9dba06aee499f51c73ba
vim +/if +56 include/linux/compiler.h

2bcd521a684cc9 Steven Rostedt 2008-11-21  50  
2bcd521a684cc9 Steven Rostedt 2008-11-21  51  #ifdef CONFIG_PROFILE_ALL_BRANCHES
2bcd521a684cc9 Steven Rostedt 2008-11-21  52  /*
2bcd521a684cc9 Steven Rostedt 2008-11-21  53   * "Define 'is'", Bill Clinton
2bcd521a684cc9 Steven Rostedt 2008-11-21  54   * "Define 'if'", Steven Rostedt
2bcd521a684cc9 Steven Rostedt 2008-11-21  55   */
a15fd609ad53a6 Linus Torvalds 2019-03-20 @56  #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
a15fd609ad53a6 Linus Torvalds 2019-03-20  57  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36099 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-21 20:45   ` Will Deacon
@ 2020-09-28 23:08     ` Will Deacon
  2020-09-29  1:37       ` yukuai (C)
  0 siblings, 1 reply; 10+ messages in thread
From: Will Deacon @ 2020-09-28 23:08 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, yi.zhang, linux-arm-msm, iommu, linux-kernel,
	clang-built-linux, Yu Kuai, linux-arm-kernel

On Mon, Sep 21, 2020 at 09:45:57PM +0100, Will Deacon wrote:
> On Tue, Sep 22, 2020 at 03:13:53AM +0800, kernel test robot wrote:
> > Thank you for the patch! Perhaps something to improve:
> > 
> > [auto build test WARNING on iommu/next]
> > [also build test WARNING on linus/master v5.9-rc6 next-20200921]
> > [cannot apply to robclark/msm-next]
> > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://git-scm.com/docs/git-format-patch]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
> > config: arm64-randconfig-r023-20200920 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4e8c028158b56d9c2142a62464e8e0686bde3584)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # install arm64 cross compiling tool for clang build
> >         # apt-get install binutils-aarch64-linux-gnu
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>):
> > 
> > >> drivers/iommu/arm/arm-smmu/qcom_iommu.c:601:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
> >                            return -EINVAL;
> >                            ^
> >    drivers/iommu/arm/arm-smmu/qcom_iommu.c:599:3: note: previous statement is here
> >                    if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
> 
> Oh, this looks like a nasty bug. Seems we're missing some braces.

Yu Kuai: please could you send a v2 of this?

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
  2020-09-28 23:08     ` Will Deacon
@ 2020-09-29  1:37       ` yukuai (C)
  0 siblings, 0 replies; 10+ messages in thread
From: yukuai (C) @ 2020-09-29  1:37 UTC (permalink / raw)
  To: Will Deacon, kernel test robot
  Cc: kbuild-all, yi.zhang, linux-arm-msm, iommu, linux-kernel,
	clang-built-linux, linux-arm-kernel


On 2020/09/29 7:08, Will Deacon wrote:
> On Mon, Sep 21, 2020 at 09:45:57PM +0100, Will Deacon wrote:
>> On Tue, Sep 22, 2020 at 03:13:53AM +0800, kernel test robot wrote:
>>> Thank you for the patch! Perhaps something to improve:
>>>
>>> [auto build test WARNING on iommu/next]
>>> [also build test WARNING on linus/master v5.9-rc6 next-20200921]
>>> [cannot apply to robclark/msm-next]
>>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>>> And when submitting patch, we suggest to use '--base' as documented in
>>> https://git-scm.com/docs/git-format-patch]
>>>
>>> url:    https://github.com/0day-ci/linux/commits/Yu-Kuai/iommu-qcom-add-missing-put_device-call-in-qcom_iommu_of_xlate/20200918-091341
>>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
>>> config: arm64-randconfig-r023-20200920 (attached as .config)
>>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4e8c028158b56d9c2142a62464e8e0686bde3584)
>>> reproduce (this is a W=1 build):
>>>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>          chmod +x ~/bin/make.cross
>>>          # install arm64 cross compiling tool for clang build
>>>          # apt-get install binutils-aarch64-linux-gnu
>>>          # save the attached .config to linux build tree
>>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <lkp@intel.com>
>>>
>>> All warnings (new ones prefixed by >>):
>>>
>>>>> drivers/iommu/arm/arm-smmu/qcom_iommu.c:601:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
>>>                             return -EINVAL;
>>>                             ^
>>>     drivers/iommu/arm/arm-smmu/qcom_iommu.c:599:3: note: previous statement is here
>>>                     if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
>>
>> Oh, this looks like a nasty bug. Seems we're missing some braces.
> 
> Yu Kuai: please could you send a v2 of this?
> 

Hi, Will

Thanks for your notice, will send a V2 soon.

Yu Kuai
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
@ 2020-09-18 15:17 Markus Elfring
  0 siblings, 0 replies; 10+ messages in thread
From: Markus Elfring @ 2020-09-18 15:17 UTC (permalink / raw)
  To: Yu Kuai, iommu, linux-arm-kernel, linux-arm-msm
  Cc: Yi Zhang, kernel-janitors, linux-kernel, Will Deacon

…
> +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> @@ -595,6 +597,7 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
>  		 * banks are ok, but multiple devices are not:
>  		 */
>  		if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
> +			put_device(&iommu_pdev->dev);
>  			return -EINVAL;
>  	}

* Would there be a need to use curly brackets for such an if branch?

* I suggest to add a jump target so that a bit of common exception handling code
  can be better reused for this function implementation.

Regards,
Markus
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-29  1:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  1:13 [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Yu Kuai
2020-09-21 17:50 ` Will Deacon
2020-09-21 18:27   ` Rob Clark
2020-09-21 18:33     ` Rob Clark
2020-09-21 19:13 ` kernel test robot
2020-09-21 20:45   ` Will Deacon
2020-09-28 23:08     ` Will Deacon
2020-09-29  1:37       ` yukuai (C)
2020-09-23  4:32 ` kernel test robot
2020-09-18 15:17 Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).