From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 824232BDC0E; Sat, 12 Sep 2026 07:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789197944; cv=none; b=Xg3jKzOm8pIKNJWycFQgL25JPQdueMqaZIPocqlGdKjtPiWcSeXqWfUyy64rA0BwpQO8j46T3oY6ET+O7QZHeM7IYcirKeWURPonExxTkJDphL9AoWr2b+33BLMkxWXohrTtr4LHeOuU/2Sxc8JFIHHG2rbhJehiVt/v3WbYDbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789197944; c=relaxed/simple; bh=+47zbszwzLpC2PhwsRW0M/XqfySAL+kNgnAN1Y9JMMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b/IKTnvi5hVtCQVf6+bB1MalpqET5YaPNeDwlHib+y7K4gcWzre7SEf6kee0xfpFMy0VaDa5GSSqengiF7Bzcg/fLZA+CT31QyPo93xlcE0Aor9OI48i+PLORoBKGxYNxqlbwO4xFeEeVZ1iPLZGN1Y+Oj2S4H1Wd3bIl5hEzdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uLzHm4+f; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uLzHm4+f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 863721F000FF; Sat, 12 Sep 2026 07:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789197943; bh=05UbBRHvFBl4PLlyTA617/ebw7BrzP5W6wPXRYuKqqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uLzHm4+f08C//bQqYPXB5rPXIxpMhy3tJPo9cJzvWX1Tp04oPHmk4UeJLYTTq2daV ZHEXfyoPwKjyVI4d35ZheaSAJgOVvG8W99ekU0k7oBpW1yfNrFHeHq9AIPpy8qVm0w 8sudJg9+yOWbzvcnWvbJLCcm5tbzaSdQj1hLkWwc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bjorn Andersson , Konrad Dybcio , Sasha Levin Subject: [PATCH 7.2 0272/1815] usb: typec: ucsi: unregister debugfs entries on teardown Date: Sat, 12 Sep 2026 08:33:42 +0200 Message-ID: <20260912065655.354113114@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bjorn Andersson [ Upstream commit eed73a65ab609b79d53de88cccc34b36dfe753c4 ] ucsi_register() creates per-instance debugfs entries, but ucsi_unregister() keeps them around until ucsi_destroy(). Drivers like ucsi_glink that unregister/register the same UCSI instance across remoteproc restart then try to create an already existing debugfs directory and log: debugfs: 'pmic_glink.ucsi.0' already exists in 'ucsi' Unregister debugfs entries as part of ucsi_unregister(), and clear ucsi->debugfs after freeing it so repeated unregister paths remain safe. Assisted-by: Codex:GPT-5.5 Signed-off-by: Bjorn Andersson Fixes: df0383ffad64 ("usb: typec: ucsi: Add debugfs for ucsi commands") Tested-by: Konrad Dybcio # X1E80100 CRD Reviewed-by: Konrad Dybcio Link: https://patch.msgid.link/20260611-usci-unregister-debugfs-v1-1-f4a518a94f27@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/debugfs.c | 1 + drivers/usb/typec/ucsi/ucsi.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/usb/typec/ucsi/debugfs.c b/drivers/usb/typec/ucsi/debugfs.c index ff33a5e7c6b0d..a124105b6226d 100644 --- a/drivers/usb/typec/ucsi/debugfs.c +++ b/drivers/usb/typec/ucsi/debugfs.c @@ -162,6 +162,7 @@ void ucsi_debugfs_unregister(struct ucsi *ucsi) debugfs_remove_recursive(ucsi->debugfs->dentry); kfree(ucsi->debugfs); + ucsi->debugfs = NULL; } void ucsi_debugfs_init(void) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 81d74242c816c..b3a7712a64507 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -2367,6 +2367,8 @@ void ucsi_unregister(struct ucsi *ucsi) cancel_delayed_work_sync(&ucsi->work); cancel_work_sync(&ucsi->resume_work); + ucsi_debugfs_unregister(ucsi); + /* Disable notifications */ ucsi->ops->async_control(ucsi, cmd); -- 2.53.0