Patch "regulator: core: Avoid debugfs: Directory ... already present! error" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    regulator: core: Avoid debugfs: Directory ... already present! error

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     regulator-core-avoid-debugfs-directory-.-already-pre.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0fc651793a5641cfc9f9a5b622b2db1fe2f79cad
Author: Hans de Goede <hdegoede@xxxxxxxxxx>
Date:   Fri Jan 22 19:32:50 2021 +0100

    regulator: core: Avoid debugfs: Directory ... already present! error
    
    [ Upstream commit dbe954d8f1635f949a1d9a5d6e6fb749ae022b47 ]
    
    Sometimes regulator_get() gets called twice for the same supply on the
    same device. This may happen e.g. when a framework / library is used
    which uses the regulator; and the driver itself also needs to enable
    the regulator in some cases where the framework will not enable it.
    
    Commit ff268b56ce8c ("regulator: core: Don't spew backtraces on
    duplicate sysfs") already takes care of the backtrace which would
    trigger when creating a duplicate consumer symlink under
    /sys/class/regulator/regulator.%d in this scenario.
    
    Commit c33d442328f5 ("debugfs: make error message a bit more verbose")
    causes a new error to get logged in this scenario:
    
    [   26.938425] debugfs: Directory 'wm5102-codec-MICVDD' with parent 'spi-WM510204:00-MICVDD' already present!
    
    There is no _nowarn variant of debugfs_create_dir(), but we can detect
    and avoid this problem by checking the return value of the earlier
    sysfs_create_link_nowarn() call.
    
    Add a check for the earlier sysfs_create_link_nowarn() failing with
    -EEXIST and skip the debugfs_create_dir() call in that case, avoiding
    this error getting logged.
    
    Fixes: c33d442328f5 ("debugfs: make error message a bit more verbose")
    Cc: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210122183250.370571-1-hdegoede@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5b9d570df85cc..a31b6ae92a84e 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1576,7 +1576,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
 					  const char *supply_name)
 {
 	struct regulator *regulator;
-	int err;
+	int err = 0;
 
 	if (dev) {
 		char buf[REG_STR_SIZE];
@@ -1622,8 +1622,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
 		}
 	}
 
-	regulator->debugfs = debugfs_create_dir(supply_name,
-						rdev->debugfs);
+	if (err != -EEXIST)
+		regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs);
 	if (!regulator->debugfs) {
 		rdev_dbg(rdev, "Failed to create debugfs directory\n");
 	} else {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux