From 175fb4a3cc2b8373fe9266e1aba7e66925ec7da4 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Wed, 8 Nov 2023 17:39:47 +0800 Subject: [PATCH] regulator: core: Ensure debugfs is fully initialized regulator->debugfs is NULL when sysfs_create_link_nowarn() return -EEXIST, and triggering the following warning: [ 2.426974] debugfs: File 'uA_load' in directory '/' already present! [ 2.426983] debugfs: File 'min_uV' in directory '/' already present! [ 2.426991] debugfs: File 'max_uV' in directory '/' already present! [ 2.426999] debugfs: File 'constraint_flags' in directory '/' already present! Fixes: 08880713ceec ("regulator: core: Streamline debugfs operations") Fixes: 2715bb11cfff ("regulator: core: Fix more error checking for debugfs_create_dir()") Signed-off-by: Tao Huang Change-Id: Iab0b91cacba410705a643d7198eee4f70e1108d5 --- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f3e98005038f..55dafde400df 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1924,6 +1924,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, if (err != -EEXIST) regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs); + else + regulator->debugfs = ERR_PTR(err); if (IS_ERR(regulator->debugfs)) rdev_dbg(rdev, "Failed to create debugfs directory\n");