Re: [PATCH] i2c: Fix core-managed per-client debugfs handling

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

 



On Mon, Jan 27, 2025 at 07:39:38AM -0800, Guenter Roeck wrote:
> Per-driver debugfs entries are created in the device probe function and
> released in the device remove function. The common debugfs directory
> introduced with commit d06905d68610 ("i2c: add core-managed per-client
> directory in debugfs") is added when a device is registered, not when it
> is probed, and it is removed when the device is unregistered. As result,
> debugfs entries added by a driver are not deleted when a device remove
> function is called since that does not necessarily result in device
> unregistration. If the probe function is then called again, the debugfs
> entries will already exist, which will result in error messages such as
> 
> 	debugfs: File 'test' in directory '3-0020' already present!
> 
> if 'test' was a debugfs file created during the first call to probe().
> 
> This is easy to reproduce by executing "modprobe -r" followed by "modprobe"
> with a driver using the debugfs pointer created by the i2c subsystem.
> 
> The debugfs directory should be created when a device is probed, not when
> it is registered. It should be removed when the device is removed, not
> when it is unregistered. Change the code accordingly.
> 
> Also clear the client->debugfs if creating the debugfs directory fails.
> This simplifies I2C client driver code if it needs to call dentry
> functions which do not validate dentry pointers passed as argument.
> 
> Fixes: d06905d68610 ("i2c: add core-managed per-client directory in debugfs")
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

Applied to for-current, thanks!

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux