public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iommu/tegra-smmu: drop error checking for debugfs_create_dir()
@ 2023-10-25 15:25 Dario Binacchi
  2023-11-27  9:27 ` Joerg Roedel
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Binacchi @ 2023-10-25 15:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dario Binacchi, Baolu Lu, Joerg Roedel, Jonathan Hunter,
	Krishna Reddy, Robin Murphy, Thierry Reding, Will Deacon, iommu,
	linux-tegra

The return value of debugfs_create_dir() should be checked using the
IS_ERR() function. The patch, however, drops the check statement without
fixing it because the subsequent functions (i. e. debugfs_create_file())
can handle the case where `@parent` is an error pointer.

Suggested-by: Baolu Lu <baolu.lu@linux.intel.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

Changes in v2:
 - drop the error checking statement

 drivers/iommu/tegra-smmu.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index e445f80d0226..3e573148d18c 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1056,9 +1056,6 @@ DEFINE_SHOW_ATTRIBUTE(tegra_smmu_clients);
 static void tegra_smmu_debugfs_init(struct tegra_smmu *smmu)
 {
 	smmu->debugfs = debugfs_create_dir("smmu", NULL);
-	if (!smmu->debugfs)
-		return;
-
 	debugfs_create_file("swgroups", S_IRUGO, smmu->debugfs, smmu,
 			    &tegra_smmu_swgroups_fops);
 	debugfs_create_file("clients", S_IRUGO, smmu->debugfs, smmu,
-- 
2.42.0


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

* Re: [PATCH v2] iommu/tegra-smmu: drop error checking for debugfs_create_dir()
  2023-10-25 15:25 [PATCH v2] iommu/tegra-smmu: drop error checking for debugfs_create_dir() Dario Binacchi
@ 2023-11-27  9:27 ` Joerg Roedel
  2023-11-28 11:25   ` Thierry Reding
  0 siblings, 1 reply; 3+ messages in thread
From: Joerg Roedel @ 2023-11-27  9:27 UTC (permalink / raw)
  To: Dario Binacchi
  Cc: linux-kernel, Baolu Lu, Jonathan Hunter, Krishna Reddy,
	Robin Murphy, Thierry Reding, Will Deacon, iommu, linux-tegra

On Wed, Oct 25, 2023 at 05:25:58PM +0200, Dario Binacchi wrote:
> The return value of debugfs_create_dir() should be checked using the
> IS_ERR() function. The patch, however, drops the check statement without
> fixing it because the subsequent functions (i. e. debugfs_create_file())
> can handle the case where `@parent` is an error pointer.

This deserves a comment in the code explaining why no error checking is
needed.

Regards,

	Joerg


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

* Re: [PATCH v2] iommu/tegra-smmu: drop error checking for debugfs_create_dir()
  2023-11-27  9:27 ` Joerg Roedel
@ 2023-11-28 11:25   ` Thierry Reding
  0 siblings, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2023-11-28 11:25 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Dario Binacchi, linux-kernel, Baolu Lu, Jonathan Hunter,
	Krishna Reddy, Robin Murphy, Will Deacon, iommu, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

On Mon, Nov 27, 2023 at 10:27:40AM +0100, Joerg Roedel wrote:
> On Wed, Oct 25, 2023 at 05:25:58PM +0200, Dario Binacchi wrote:
> > The return value of debugfs_create_dir() should be checked using the
> > IS_ERR() function. The patch, however, drops the check statement without
> > fixing it because the subsequent functions (i. e. debugfs_create_file())
> > can handle the case where `@parent` is an error pointer.
> 
> This deserves a comment in the code explaining why no error checking is
> needed.

This is a duplicate of f7da9c081517 ("iommu/tegra-smmu: Drop unnecessary
error check for for debugfs_create_dir()"), which is already in v6.7-rc1
so I think we can ignore this one.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-11-28 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25 15:25 [PATCH v2] iommu/tegra-smmu: drop error checking for debugfs_create_dir() Dario Binacchi
2023-11-27  9:27 ` Joerg Roedel
2023-11-28 11:25   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox