[PATCH] i2c: npcm7xx: Fix error handling in npcm_i2c_init()
Wolfram Sang
wsa at kernel.org
Sun Nov 13 07:27:42 AEDT 2022
On Wed, Nov 09, 2022 at 11:22:50AM +0000, Yuan Can wrote:
> A problem about i2c-npcm7xx create debugfs failed is triggered with the
> following log given:
>
> [ 173.827310] debugfs: Directory 'npcm_i2c' with parent '/' already present!
>
> The reason is that npcm_i2c_init() returns platform_driver_register()
> directly without checking its return value, if platform_driver_register()
> failed, it returns without destroy the newly created debugfs, resulting
> the debugfs of npcm_i2c can never be created later.
>
> npcm_i2c_init()
> debugfs_create_dir() # create debugfs directory
> platform_driver_register()
> driver_register()
> bus_add_driver()
> priv = kzalloc(...) # OOM happened
> # return without destroy debugfs directory
>
> Fix by removing debugfs when platform_driver_register() returns error.
>
> Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
> Signed-off-by: Yuan Can <yuancan at huawei.com>
Applied to for-current, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20221112/9ea75b67/attachment.sig>
More information about the openbmc
mailing list