[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z5fsdIfeDIcfuntH@ninjato>
Date: Mon, 27 Jan 2025 21:28:36 +0100
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: Fix core-managed per-client debugfs handling
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@...ck-us.net>
Applied to for-current, thanks!
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists