From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C0E3221271 for ; Sun, 23 Nov 2025 15:38:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763912300; cv=none; b=swRVaNnpjppZ8bq7e0scFdMq45Rwp0yf5S9q2lq8RR/3ZxHHI2l+f7yEP/pr5RNEwHq6DozfvuAxBLBN+Z/jsyymPZ6vD5/gcuk9LTBJ2l82hYda0fng1K9G0yDlNzNtTrHdNXdBGGALcyRVy7GXEOyu+JjOccbcrj/H9tgBb9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763912300; c=relaxed/simple; bh=26Sk3Y2kuXpTOow69RkB5IRH8M3p7ykcu2ZSiUnEhpY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KCacsPAgaRu97zdNyTtJvTAR1e8Yj3pD3kcWKJoHL88288FYeqGYVECHFNrP86zFnZSJc1T/a1sllqPbSC7KcqIh3LDJ/NvJ3k6lYtg3c4BNQ1ji3tnmhpg5PKeF6r5Etf9K4Onkc91FCUVioqv8dA7s7J+8YfYm75/tN+AXjNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ROYPywoC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ROYPywoC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB95BC113D0; Sun, 23 Nov 2025 15:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763912300; bh=26Sk3Y2kuXpTOow69RkB5IRH8M3p7ykcu2ZSiUnEhpY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ROYPywoCq6RUVdJ6FjeCVDX7sgD8sn9vQdqScVz/zLQZl/JW3JHr0ahPCt3bEuESg hPUFdbY0Ip5MLwrAEz8vTzz4Zu92U3XQq1jvSgiwd2DMRIYtN2KpYGWjFhAN13RlEe f6STVE1bxBMY9kNGX8M6mQwUb3/+yUpJbzY3f4+HAbAjNaf4CerW9PGv5v4DCzZJ2V uKLMoVPO/nijI0r+jSba0OIEcfVLnP++5PrDsWu11GAgFpUhQbyjC4U18BEWOTy3xz 0MmnccCyU9dkVlOz7TC4PJntfHNNoaHgypPII7JD9bZg8nPxx16vgLACCPOnvfRuTh JOI1CxW8xbY7g== Message-ID: Date: Mon, 24 Nov 2025 00:38:17 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] extcon: Fixed sysfs duplicate filename issue To: Michael Wu , myungjoo.ham@samsung.com, cw00.choi@samsung.com, andriy.shevchenko@linux.intel.com Cc: linux-kernel@vger.kernel.org References: <20251024024946.16618-1-michael@allwinnertech.com> From: Chanwoo Choi Content-Language: en-US In-Reply-To: <20251024024946.16618-1-michael@allwinnertech.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 25. 10. 24. 11:49에 Michael Wu 이(가) 쓴 글: > With current extcon_dev_unregister() timing, ida_free is before > device_unregister(), that may cause current id re-alloc to another > device in extcon_dev_register() context but sysfs filename path not > removal completed yet. > > 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' > Call trace: > 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 > > Fixes: 7bba9e81a6fb ("extcon: Use unique number for the extcon device ID") > Acked-by: MyungJoo Ham > Reviewed-by: Andy Shevchenko > Signed-off-by: Michael Wu > --- > ChangeLog: > V2 -> V3: Dropped some noisy lines in commit messages, suggested by Andy Shevchenko > V1 -> V2: Update commit msg, suggested by Markus Elfring > V1: https://lore.kernel.org/all/20251011053719.87055-1-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++) Applied it. Thanks. -- Best Regards, Samsung Electronics Chanwoo Choi