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 385B934F497; Sat, 12 Sep 2026 19:16:57 +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=1789240618; cv=none; b=Y+TodtmamOo9XON7fsMUw7rrS4ypoLNdOMCzLl0ngy6aze98XX9/i2Fi2Y2B6VJ+YYkf2NZGvYVCX1NgSID3CTte8JGAWlU1cPgo5C6lIjQgqi1PDurQ0Ep7BebPri4Hy4VjiwdhqNre773iak4RERJWUeGAV/yfqR3toZIMJmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789240618; c=relaxed/simple; bh=AsPZmwQArJQAMmC8KqlRWPxiLb8ipN1yuCyUIFZ1c9I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cAO773yQCHR8robF6tQeG/RxQXVOq3YXLDVaiFAm4T2Qk4aacRPerr6EuCxqY3agMxGPsvAOa3BkPL3Ow670u51nq6MJZyCAVeWqZcMHWo6f/go1/APA0M6G7BhJ0KaHeZzNEtT0+PNKe1DDhvaCEmulKR5SPm+SkFd6SIq75LE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AsNGriU0; 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="AsNGriU0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BD601F000FF; Sat, 12 Sep 2026 19:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789240617; bh=Kp3gF6dWHIDJN0/IvhiYJr9Ho4BDt2JpNFRBWUPvQ9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AsNGriU0qvou1b3keHPbttL2/iMySajnWr3OkrswsvUTjDnDEwF0oE+HleEPX1ZHm AbW4Nqk49Ir5pPfXLXL70oFq0+/BhLURhyzR0BNT9nhQXpONn80+dDf5AYmCigs1Ky TM+qd490+AOh2ewUijCFUDGan4ZXevH/+fuusuQg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yi Ding , Alexandre Belloni , Sasha Levin Subject: [PATCH 5.15 863/935] rtc: pcf8563: fix clock provider leak on unbind Date: Sat, 12 Sep 2026 09:04:53 +0200 Message-ID: <20260912065546.616645002@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yi Ding [ Upstream commit 9c48a53685040bb0de45a640b34055cbbfc69d4f ] pcf8563_clkout_register_clk() registers the CLKOUT clock provider with of_clk_add_provider(), but nothing ever unwinds it: there is no of_clk_del_provider() call and the driver has no remove callback. Each of_clk_add_provider() allocates a struct of_clk_provider, takes a reference on the OF node and adds an entry to the global of_clk_providers list, none of which is released when the device is unbound. Every bind/unbind (or module reload) therefore leaks a provider structure and an of_node reference. The clock itself is already device-managed (devm_clk_register()); only the provider registration was not. Use devm_of_clk_add_hw_provider() so the provider is removed automatically on unbind. Tie it to the parent i2c device, whose OF node carries the #clock-cells and clock-output-names properties (the RTC class device has no OF node of its own). Fixes: a39a6405d5f9 ("rtc: pcf8563: add CLKOUT to common clock framework") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Yi Ding Link: https://patch.msgid.link/20260602035135.62264-1-yi.s.ding@gmail.com Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- drivers/rtc/rtc-pcf8563.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 7d47d1f4802a4..1797c071ca628 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -507,7 +507,9 @@ static struct clk *pcf8563_clkout_register_clk(struct pcf8563 *pcf8563) clk = devm_clk_register(&client->dev, &pcf8563->clkout_hw); if (!IS_ERR(clk)) - of_clk_add_provider(node, of_clk_src_simple_get, clk); + devm_of_clk_add_hw_provider(pcf8563->rtc->dev.parent, + of_clk_hw_simple_get, + &pcf8563->clkout_hw); return clk; } -- 2.53.0