Re: [PATCH v2 2/2] iommu/tegra-smmu: Expend mutex protection range
From: Nicolin Chen
Date: Mon Sep 28 2020 - 21:21:22 EST
On Tue, Sep 29, 2020 at 03:17:58AM +0300, Dmitry Osipenko wrote:
> ...
> > static bool tegra_smmu_capable(enum iommu_cap cap)
> > @@ -420,17 +413,21 @@ static int tegra_smmu_as_prepare(struct tegra_smmu *smmu,
> > struct tegra_smmu_as *as)
> > {
> > u32 value;
> > - int err;
> > + int err = 0;
> > +
> > + mutex_lock(&smmu->lock);
> >
> > if (as->use_count > 0) {
> > as->use_count++;
> > - return 0;
> > + goto err_unlock;
>
> This looks a bit odd because it's not a error condition. Perhaps should
> be better to "goto bump_usecount"?
>
> Or make it similar to tegra_smmu_as_unprepare()?
Hmm...I think it's simple to just make it "goto unlock" then.