lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230530172439.13683-1-osmtendev@gmail.com>
Date:   Tue, 30 May 2023 22:24:39 +0500
From:   Osama Muhammad <osmtendev@...il.com>
To:     rafael@...nel.org, daniel.lezcano@...aro.org, rui.zhang@...el.com,
        angelogioacchino.delregno@...labora.com,
        DLG-Adam.Ward.opensource@...renesas.com, amitk@...nel.org,
        wenst@...omium.org
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Osama Muhammad <osmtendev@...il.com>
Subject: [PATCH] lvts_thermal.c: Drop error checking for debugfs_create_dir

This patch removes the error checking for debugfs_create_dir
in lvts_thermal.c. This is because the debugfs_create_dir()
does not return NULL but an ERR_PTR after an error.
The DebugFS kernel API is developed in a way that the
caller can safely ignore the errors that occur during
the creation of DebugFS nodes.The debugfs Api handles
it gracefully. The check is unnecessary.

Link to the comment above debugfs_create_dir:
https://elixir.bootlin.com/linux/latest/source/fs/debugfs/inode.c#L451

Signed-off-by: Osama Muhammad <osmtendev@...il.com>
---
 drivers/thermal/mediatek/lvts_thermal.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index d0a3f95b7884..da5e3652ff3b 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -179,7 +179,7 @@ static const struct debugfs_reg32 lvts_regs[] = {
 	LVTS_DEBUG_FS_REGS(LVTS_CLKEN),
 };
 
-static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
+static void lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
 {
 	struct debugfs_regset32 *regset;
 	struct lvts_ctrl *lvts_ctrl;
@@ -188,8 +188,6 @@ static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
 	int i;
 
 	lvts_td->dom_dentry = debugfs_create_dir(dev_name(dev), NULL);
-	if (!lvts_td->dom_dentry)
-		return 0;
 
 	for (i = 0; i < lvts_td->num_lvts_ctrl; i++) {
 
@@ -197,8 +195,6 @@ static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
 
 		sprintf(name, "controller%d", i);
 		dentry = debugfs_create_dir(name, lvts_td->dom_dentry);
-		if (!dentry)
-			continue;
 
 		regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
 		if (!regset)
@@ -211,7 +207,6 @@ static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
 		debugfs_create_regset32("registers", 0400, dentry, regset);
 	}
 
-	return 0;
 }
 
 static void lvts_debugfs_exit(struct lvts_domain *lvts_td)
@@ -221,10 +216,9 @@ static void lvts_debugfs_exit(struct lvts_domain *lvts_td)
 
 #else
 
-static inline int lvts_debugfs_init(struct device *dev,
+static inline void lvts_debugfs_init(struct device *dev,
 				    struct lvts_domain *lvts_td)
 {
-	return 0;
 }
 
 static void lvts_debugfs_exit(struct lvts_domain *lvts_td) { }
@@ -1099,7 +1093,8 @@ static int lvts_domain_init(struct device *dev, struct lvts_domain *lvts_td,
 		}
 	}
 
-	return lvts_debugfs_init(dev, lvts_td);
+	lvts_debugfs_init(dev, lvts_td);
+	return 0;
 }
 
 static int lvts_probe(struct platform_device *pdev)
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ