[<prev] [next>] [day] [month] [year] [list]
Message-ID: <831d07ac-1cc6-3042-a836-b634cf8af774@huawei.com>
Date: Wed, 23 Nov 2022 17:56:59 +0800
From: Zeng Heng <zengheng4@...wei.com>
To: <broonie@...nel.org>, <lgirdwood@...il.com>
CC: <liwei391@...wei.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] regulator: core: fix kernfs complain in
destroy_regulator()
+cc linux-kernel-mail-list
On 2022/11/23 17:15, Zeng Heng wrote:
> Creating sysfs entry failed is non-fatal exception any more since from
> commit <222cc7b1cefb>, so when try to remove the entry in
> _regulator_put(), it had better to check kernfs_node before calling
> sysfs_remove_link().
>
> Otherwise, kernfs would complain warning as below:
>
> kernfs: can not remove 'rt5759_buck_consumer-default', no directory
> WARNING: CPU: 2 PID: 3383 at fs/kernfs/dir.c:1615 kernfs_remove_by_name_ns+0xd5/0xe0
> Call Trace:
> _regulator_put.part.0+0xca/0x2f0
> regulator_put+0x37/0x50
> release_nodes+0x6a/0xa0
> devres_release_all+0xfe/0x150
> device_unbind_cleanup+0x19/0xd0
> device_release_driver_internal+0x17d/0x210
> bus_remove_device+0x1bd/0x240
> device_del+0x356/0x780
> platform_device_del.part.0+0x1a/0x100
> platform_device_unregister+0x29/0x50
>
> Fixes: 222cc7b1cefb ("regulator: core: Allow multiple requests of a single supply mapping")
> Signed-off-by: Zeng Heng <zengheng4@...wei.com>
> ---
> drivers/regulator/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 77126cb1ae8c..ca3981681bbf 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -2294,7 +2294,8 @@ static void destroy_regulator(struct regulator *regulator)
> device_link_remove(regulator->dev, &rdev->dev);
>
> /* remove any sysfs entries */
> - sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
> + if (rdev->dev.kobj.sd)
> + sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
> }
>
> regulator_lock(rdev);
Powered by blists - more mailing lists