From: Amey Narkhede <ameynarkhede03@gmail.com>
To: Will Deacon <will@kernel.org>
Cc: Rob Clark <robdclark@gmail.com>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org, linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/qcom: Cleanup resources in case of probe error path
Date: Tue, 8 Jun 2021 20:25:00 +0530 [thread overview]
Message-ID: <20210608145500.wxtes4wpp4rpw7si@archlinux> (raw)
In-Reply-To: <20210608092958.GA8935@willie-the-truck>
On 21/06/08 10:29AM, Will Deacon wrote:
> On Thu, Apr 22, 2021 at 03:40:30AM +0530, Amey Narkhede wrote:
> > If device registration fails, remove sysfs attribute
> > and if setting bus callbacks fails, unregister the device
> > and cleanup the sysfs attribute.
> >
> > Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
> > ---
> > drivers/iommu/arm/arm-smmu/qcom_iommu.c | 14 ++++++++++++--
> > 1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> > index 4294abe389b2..5fa128a1f7f0 100644
> > --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> > +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> > @@ -850,10 +850,12 @@ static int qcom_iommu_device_probe(struct platform_device *pdev)
> > ret = iommu_device_register(&qcom_iommu->iommu, &qcom_iommu_ops, dev);
> > if (ret) {
> > dev_err(dev, "Failed to register iommu\n");
> > - return ret;
> > + goto err_sysfs_remove;
> > }
> >
> > - bus_set_iommu(&platform_bus_type, &qcom_iommu_ops);
> > + ret = bus_set_iommu(&platform_bus_type, &qcom_iommu_ops);
> > + if (ret)
> > + goto err_unregister_device;
> >
> > if (qcom_iommu->local_base) {
> > pm_runtime_get_sync(dev);
> > @@ -862,6 +864,14 @@ static int qcom_iommu_device_probe(struct platform_device *pdev)
> > }
> >
> > return 0;
> > +
> > +err_unregister_device:
> > + iommu_device_unregister(&qcom_iommu->iommu);
> > +
> > +err_sysfs_remove:
> > + iommu_device_sysfs_remove(&qcom_iommu->iommu);
> > +
> > + return ret;
>
> It looks like we're also missing this logic in arm-smmu/arm-smmu.c and
> arm-smmu-v3/arm-smmu-v3.c. Would you be able to fix those up too, please?
>
> Will
Sure, I will send a v2 with this and new patches.
Thanks,
Amey
prev parent reply other threads:[~2021-06-08 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 22:10 [PATCH] iommu/qcom: Cleanup resources in case of probe error path Amey Narkhede
2021-06-08 9:29 ` Will Deacon
2021-06-08 14:55 ` Amey Narkhede [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210608145500.wxtes4wpp4rpw7si@archlinux \
--to=ameynarkhede03@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).