* [PATCH] extcon: Fixed extcon duplicate issue
@ 2025-10-11 5:37 ` Michael Wu
2025-10-12 17:06 ` Markus Elfring
2025-10-13 6:32 ` MyungJoo Ham
0 siblings, 2 replies; 3+ messages in thread
From: Michael Wu @ 2025-10-11 5:37 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi; +Cc: linux-kernel
extcon_dev_ids may re-alloc to another while this device unregister not complete
The right timing shows below:
on extcon_dev_register: ida_alloc -> device_register
on extcon_dev_unregister: device_unregister -> ida_free
stack information when an error occurs:
sysfs: cannot create duplicate filename '/class/extcon/extcon1'
CPU: 7 PID: 222 Comm: init Not tainted 6.6.77-android15-8-g9fab1123989e-ab13366090-4k #1 bbfe3ef014a40c2f67534a3e01169790ce021aeb
Hardware name: sun60iw2 (DT)
Call trace:
dump_backtrace+0xe8/0x108
show_stack+0x18/0x28
dump_stack_lvl+0x50/0x6c
dump_stack+0x18/0x24
sysfs_warn_dup+0x68/0x88
sysfs_do_create_link_sd+0x94/0xdc
sysfs_create_link+0x30/0x48
device_add_class_symlinks+0xb4/0x12c
device_add+0x1e0/0x48c
device_register+0x20/0x34
extcon_dev_register+0x3b8/0x5c4
devm_extcon_dev_register+0x4c/0x94
Signed-off-by: Michael Wu <michael@allwinnertech.com>
---
drivers/extcon/extcon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index e7f55c021e562..c08f642d7f5ee 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1371,10 +1371,10 @@ void extcon_dev_unregister(struct extcon_dev *edev)
return;
}
- ida_free(&extcon_dev_ids, edev->id);
-
device_unregister(&edev->dev);
+ ida_free(&extcon_dev_ids, edev->id);
+
if (edev->mutually_exclusive && edev->max_supported) {
for (index = 0; edev->mutually_exclusive[index];
index++)
--
2.29.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] extcon: Fixed extcon duplicate issue
2025-10-11 5:37 ` [PATCH] extcon: Fixed extcon duplicate issue Michael Wu
@ 2025-10-12 17:06 ` Markus Elfring
2025-10-13 6:32 ` MyungJoo Ham
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-10-12 17:06 UTC (permalink / raw)
To: Michael Wu, kernel-janitors, Chanwoo Choi, MyungJoo Ham; +Cc: LKML
> extcon_dev_ids may re-alloc to another while this device unregister not complete
…
Will another imperative wording approach become more helpful for an improved
change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n94
How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n145
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] extcon: Fixed extcon duplicate issue
2025-10-11 5:37 ` [PATCH] extcon: Fixed extcon duplicate issue Michael Wu
2025-10-12 17:06 ` Markus Elfring
@ 2025-10-13 6:32 ` MyungJoo Ham
1 sibling, 0 replies; 3+ messages in thread
From: MyungJoo Ham @ 2025-10-13 6:32 UTC (permalink / raw)
To: Michael Wu, Chanwoo Choi; +Cc: linux-kernel@vger.kernel.org
>extcon_dev_ids may re-alloc to another while this device unregister not complete
>
>The right timing shows below:
>on extcon_dev_register: ida_alloc -> device_register
>on extcon_dev_unregister: device_unregister -> ida_free
>
>stack information when an error occurs:
>sysfs: cannot create duplicate filename '/class/extcon/extcon1'
>CPU: 7 PID: 222 Comm: init Not tainted 6.6.77-android15-8-g9fab1123989e-ab13366090-4k #1 bbfe3ef014a40c2f67534a3e01169790ce021aeb
>Hardware name: sun60iw2 (DT)
>Call trace:
> dump_backtrace+0xe8/0x108
> show_stack+0x18/0x28
> dump_stack_lvl+0x50/0x6c
> dump_stack+0x18/0x24
> sysfs_warn_dup+0x68/0x88
> sysfs_do_create_link_sd+0x94/0xdc
> sysfs_create_link+0x30/0x48
> device_add_class_symlinks+0xb4/0x12c
> device_add+0x1e0/0x48c
> device_register+0x20/0x34
> extcon_dev_register+0x3b8/0x5c4
> devm_extcon_dev_register+0x4c/0x94
>
>Signed-off-by: Michael Wu <michael@allwinnertech.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Cheers,
MyungJoo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-13 6:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20251011061953epcas1p100a774e1790cd78ccfd9f836bb29c693@epcms1p7>
2025-10-11 5:37 ` [PATCH] extcon: Fixed extcon duplicate issue Michael Wu
2025-10-12 17:06 ` Markus Elfring
2025-10-13 6:32 ` MyungJoo Ham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox