On Thu, Dec 09, 2021 at 05:47:18PM +0300, Dmitry Osipenko wrote: > External email: Use caution opening links or attachments > > > 09.12.2021 10:38, Nicolin Chen пишет: > > @@ -545,6 +719,15 @@ static void tegra_smmu_detach_as(struct tegra_smmu *smmu, > > if (group->swgrp != swgrp) > > continue; > > group->as = NULL; > > + > > + if (smmu->debugfs_mappings) { > > Do we really need this check? > > Looks like all debugfs_create_dir() usages in this driver are incorrect, > that function never returns NULL. Please fix this. debugfs_create_dir returns ERR_PTR on failure. So here should be to check !IS_ERR. Thanks for pointing it out! > > + struct dentry *d; > > The file name is wrong here. > > if (group->soc) > name = group->soc->name; > else > name = group->swgrp->name; Yea, I'll add this. > > > + d = debugfs_lookup(group->swgrp->name, > > + smmu->debugfs_mappings); > > + debugfs_remove(d); > > + } > > This now looks problematic to me. You created debugfs file when the > first member of the shared group was attached to AS, now you remove this > file when any device is detached. The shared debugfs file should be > refcounted or something.a Will see how to handle it. Thanks Nic