linux-kernel.vger.kernel.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
       [not found] ` <202009220340.bJfsaeQn%lkp@intel.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Yu Kuai @ 2020-09-18  1:13 UTC (permalink / raw)
  To: robdclark, will, joro
  Cc: iommu, linux-arm-msm, linux-arm-kernel, linux-kernel, yukuai3, yi.zhang

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


^ permalink raw reply related	[flat|nested] 7+ 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
       [not found] ` <202009220340.bJfsaeQn%lkp@intel.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Will Deacon @ 2020-09-21 17:50 UTC (permalink / raw)
  To: Yu Kuai
  Cc: robdclark, joro, iommu, linux-arm-msm, linux-arm-kernel,
	linux-kernel, yi.zhang

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

^ permalink raw reply	[flat|nested] 7+ 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; 7+ messages in thread
From: Rob Clark @ 2020-09-21 18:27 UTC (permalink / raw)
  To: Will Deacon
  Cc: Yu Kuai,
	list@263.net:IOMMU DRIVERS
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>,,
	list@263.net:IOMMU DRIVERS
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>,,
	linux-arm-msm,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Linux Kernel Mailing List, yi.zhang

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>

^ permalink raw reply	[flat|nested] 7+ 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; 7+ messages in thread
From: Rob Clark @ 2020-09-21 18:33 UTC (permalink / raw)
  To: Will Deacon
  Cc: Yu Kuai,
	list@263.net:IOMMU DRIVERS
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>,,
	list@263.net:IOMMU DRIVERS
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>,,
	linux-arm-msm,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Linux Kernel Mailing List, yi.zhang

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>

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

* Re: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
       [not found] ` <202009220340.bJfsaeQn%lkp@intel.com>
@ 2020-09-21 20:45   ` Will Deacon
  2020-09-28 23:08     ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2020-09-21 20:45 UTC (permalink / raw)
  To: kernel test robot
  Cc: Yu Kuai, robdclark, joro, kbuild-all, clang-built-linux, iommu,
	linux-arm-msm, linux-arm-kernel, linux-kernel, yi.zhang

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

^ permalink raw reply	[flat|nested] 7+ 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; 7+ messages in thread
From: Will Deacon @ 2020-09-28 23:08 UTC (permalink / raw)
  To: kernel test robot
  Cc: Yu Kuai, robdclark, joro, kbuild-all, clang-built-linux, iommu,
	linux-arm-msm, linux-arm-kernel, linux-kernel, yi.zhang

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

^ permalink raw reply	[flat|nested] 7+ 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; 7+ messages in thread
From: yukuai (C) @ 2020-09-29  1:37 UTC (permalink / raw)
  To: Will Deacon, kernel test robot
  Cc: robdclark, joro, kbuild-all, clang-built-linux, iommu,
	linux-arm-msm, linux-arm-kernel, linux-kernel, yi.zhang


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

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

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

Thread overview: 7+ 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
     [not found] ` <202009220340.bJfsaeQn%lkp@intel.com>
2020-09-21 20:45   ` Will Deacon
2020-09-28 23:08     ` Will Deacon
2020-09-29  1:37       ` yukuai (C)

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).