Skip to contentSkip to conversation

thermal: tegra: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Jun 13, 2019 – Jun 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: tegra: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.

Cc Zhang Rui <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc Wei Ni <[email protected]>
Cc Yangtao Li <[email protected]>
---
 drivers/thermal/tegra/soctherm.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/thermal/tegra/soctherm.c +2 -12
index fcf70a3728b6..43941eb734eb 100644
@@ -1485,23 +1485,13 @@ DEFINE_SHOW_ATTRIBUTE(regs);
 static void soctherm_debug_init(struct platform_device *pdev)
 {
 	struct tegra_soctherm *tegra = platform_get_drvdata(pdev);
-	struct dentry *root, *file;
+	struct dentry *root;
 
 	root = debugfs_create_dir("soctherm", NULL);
-	if (!root) {
-		dev_err(&pdev->dev, "failed to create debugfs directory\n");
-		return;
-	}
 
 	tegra->debugfs_dir = root;
 
-	file = debugfs_create_file("reg_contents", 0644, root,
-				   pdev, &regs_fops);
-	if (!file) {
-		dev_err(&pdev->dev, "failed to create debugfs file\n");
-		debugfs_remove_recursive(tegra->debugfs_dir);
-		tegra->debugfs_dir = NULL;
-	}
+	debugfs_create_file("reg_contents", 0644, root, pdev, &regs_fops);
 }
 #else
 static inline void soctherm_debug_init(struct platform_device *pdev) {}
Signature · 1 line
2.22.0
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Greg Kroah-Hartman

When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.

Cc Zhang Rui <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc Wei Ni <[email protected]>
Cc Yangtao Li <[email protected]>
Quoted 3 lines
---
 drivers/thermal/tegra/soctherm.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)