linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Will Deacon <will@kernel.org>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	linux-arm-kernel@lists.infradead.org,
	Robin Murphy <robin.murphy@arm.com>,
	Nicolin Chen <nicolinc@nvidia.com>
Subject: Re: [PATCH v2 5/5] iommu/arm-smmu: Convert to domain_alloc_paging()
Date: Tue, 12 Dec 2023 10:03:07 -0400	[thread overview]
Message-ID: <20231212140307.GD3014157@nvidia.com> (raw)
In-Reply-To: <20231212132651.GA29569@willie-the-truck>

On Tue, Dec 12, 2023 at 01:26:51PM +0000, Will Deacon wrote:
> > @@ -862,6 +859,18 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type)
> >  	mutex_init(&smmu_domain->init_mutex);
> >  	spin_lock_init(&smmu_domain->cb_lock);
> >  
> > +	if (dev)
> > +		cfg = dev_iommu_priv_get(dev);
> > +	if (cfg) {
> > +		int ret;
> > +
> > +		ret = arm_smmu_init_domain_context(smmu_domain, cfg->smmu, dev);
> > +		if (ret) {
> > +			kfree(smmu_domain);
> > +			return NULL;
> 
> If we're just returning NULL, can we drop 'ret'?

It is waiting to be changed to ERR_PTR. The dependent patches are
merged to rc5 now, so I can fix it in v3.

> > +		}
> > +	}
> > +
> >  	return &smmu_domain->domain;
> 
> Why do we need to handle the 'dev && !cfg' case here, instead g
> returning NULL?

dev && !cfg is impossible these days, so we can shuffle the if and
then just crash on that case like the other drivers do.

Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-12-12 14:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 18:11 [PATCH v2 0/5] Convert SMMU to domain_alloc_paging() Jason Gunthorpe
2023-10-17 18:11 ` [PATCH v2 1/5] iommu/arm-smmu: Reorganize arm_smmu_domain_add_master() Jason Gunthorpe
2023-10-17 18:11 ` [PATCH v2 2/5] iommu/arm-smmu: Convert to a global static identity domain Jason Gunthorpe
2023-12-12 13:27   ` Will Deacon
2023-12-12 14:15     ` Jason Gunthorpe
2023-12-13 13:26       ` Will Deacon
2023-12-13 13:32         ` Jason Gunthorpe
2023-10-17 18:11 ` [PATCH v2 3/5] iommu/arm-smmu: Implement IOMMU_DOMAIN_BLOCKED Jason Gunthorpe
2023-10-17 18:11 ` [PATCH v2 4/5] iommu/arm-smmu: Pass arm_smmu_domain to internal functions Jason Gunthorpe
2023-10-17 18:11 ` [PATCH v2 5/5] iommu/arm-smmu: Convert to domain_alloc_paging() Jason Gunthorpe
2023-12-12 13:26   ` Will Deacon
2023-12-12 14:03     ` Jason Gunthorpe [this message]
2023-12-12 14:10       ` Will Deacon
2023-12-13 13:27         ` Will Deacon
2023-12-13 13:32           ` Jason Gunthorpe
2024-02-09 20:05   ` Dmitry Baryshkov
2024-02-09 22:23     ` Jason Gunthorpe
2024-02-12 23:18       ` Dmitry Baryshkov
2024-02-13  0:19         ` Jason Gunthorpe
2024-02-13  7:51       ` Dmitry Baryshkov
2024-02-13 10:20         ` Robin Murphy
2024-02-13 10:55           ` Dmitry Baryshkov
2024-02-13 11:16             ` Will Deacon
2024-02-13 11:54               ` Jason Gunthorpe
2023-12-13 17:25 ` [PATCH v2 0/5] Convert SMMU " Will Deacon

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=20231212140307.GD3014157@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nicolinc@nvidia.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).