From patchwork Mon Apr 21 15:00:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 883703 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07EC11459EA; Mon, 21 Apr 2025 15:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745247662; cv=none; b=Cs69nYY+BNLe212YTtiHtFzHWb4TBvM7pTamBi4c8Ri10qMcijx+ExEAks51hYXEhEYPslUK4i7uDqHBj+qlFDHnsJ3KuxILUoREDvLXzeSkSLY7j3MdsAmAFI8VAAzO2NhZCRorn20XyUEl7atUpLL2cFwGRugik8C0nWe0nlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745247662; c=relaxed/simple; bh=iaNOkzsF96dsxsP5jO9Ta0EMxEmROOiFcolC/Wu7GGY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lMNyp+mq6reSAkJxRs0ssOBw2w7OXPKU+iyEayrJPsa6haQCKHRBX4qh8mVpfF1DJ/lqqyXXzIQJAkN7AKvQO5ROxEeLVOtzisCQ5OLbbeZdP7j7vzcLY/J1q+UXlDXxD7lZE2irnGZ9hwVP/Qh4knirjw/c9igiHhtR8H/hkh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=esv9mfjI; arc=none smtp.client-ip=80.12.242.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="esv9mfjI" Received: from localhost.localdomain ([90.11.132.44]) by smtp.orange.fr with ESMTPA id 6sdZuvbDkiSFB6sdluVIa4; Mon, 21 Apr 2025 17:00:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1745247658; bh=kmKeC0voji7GXJXSCy45n8sW+gBgOqpDdUUwmio5UWo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=esv9mfjI3IxjRMItKDgfq8laaLN4gYB6ZtonvSfzHT0HhD3vlbg8YqzU7RMqCEuh1 SBZ0EUlwuXh+LQcqzuSFPnX5HsNIVUueWxXMwSQujyHDsSngU4wGQ1GSR6IaOllgyM FZEq6hcLuvqK1H+PTmOwFGcGhItAGbRYgNgwOjoq+AcB+MaAlw42U5wDY/8oTBqKlI ujPjx8grbM3MZ1QeEnRxqNJ49Qry9Wj4URFip9YZP216LjOE8/5E9ygGiYKe6FlRpc Le6loVjsibTrrufwh4QkZ70LRVxDl1XEQW6eBi6kYsCfUmrv0gdbUIzPhIIYFlbdpI nw4Id/xBkzrmw== X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 21 Apr 2025 17:00:58 +0200 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: lee@kernel.org, krzk@kernel.org, alim.akhtar@samsung.com, s.nawrocki@samsung.com, m.szyprowski@samsung.com, ideal.song@samsung.com, beomho.seo@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Krzysztof Kozlowski Subject: [PATCH v2 1/3] mfd: exynos-lpass: Fix an error handling path in exynos_lpass_probe() Date: Mon, 21 Apr 2025 17:00:33 +0200 Message-ID: <38414eecb1096840946756ae86887aea2a489c1b.1745247209.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If an error occurs after a successful regmap_init_mmio(), regmap_exit() should be called as already done in the .remove() function. Switch to devm_regmap_init_mmio() to avoid the leak and simplify the .remove() function. Fixes: c414df12bdf7 ("mfd: exynos-lpass: Add missing remove() function") Signed-off-by: Christophe JAILLET Reviewed-by: Krzysztof Kozlowski --- Compile tested only. Changes in v2: - Add R-b tag - Change the commit ID in Fixes v1: https://lore.kernel.org/all/d125cbc479f1fa838ed0ff25f0e11d25f382e9d4.1743231856.git.christophe.jaillet@wanadoo.fr/ --- drivers/mfd/exynos-lpass.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/exynos-lpass.c b/drivers/mfd/exynos-lpass.c index 6a585173230b..6b95927e99be 100644 --- a/drivers/mfd/exynos-lpass.c +++ b/drivers/mfd/exynos-lpass.c @@ -122,8 +122,8 @@ static int exynos_lpass_probe(struct platform_device *pdev) if (IS_ERR(lpass->sfr0_clk)) return PTR_ERR(lpass->sfr0_clk); - lpass->top = regmap_init_mmio(dev, base_top, - &exynos_lpass_reg_conf); + lpass->top = devm_regmap_init_mmio(dev, base_top, + &exynos_lpass_reg_conf); if (IS_ERR(lpass->top)) { dev_err(dev, "LPASS top regmap initialization failed\n"); return PTR_ERR(lpass->top); @@ -145,7 +145,6 @@ static void exynos_lpass_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) exynos_lpass_disable(lpass); - regmap_exit(lpass->top); } static int __maybe_unused exynos_lpass_suspend(struct device *dev) From patchwork Mon Apr 21 15:00:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 882965 Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B91371C7009; Mon, 21 Apr 2025 15:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745247663; cv=none; b=mvmb2g7mJh2FyNquDpVOkQTUEydV4RiVvPiUXdK+imZ4tgobGYMnRzRx1vxTcgK9cH8wGH7LTa7BHPVC4JyyndZ+y6z1U9tT3wripNxbEbgBCxUvYNLJBP9WK7bbfcYt6dkfNueeLwJ+Ml8njRkwKFDOybMfdctfn2zoPqdOBzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745247663; c=relaxed/simple; bh=r2Oi+FdkU2X57ETtJqwc+QGUuX81xnR1Um7f3BPN7aY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=USqw5ZoTG0jzJMTiB1dYUp76Rq41tq6dvhWWaeXIWnMn23gr+lhX/uX49Fz+ERcWFClOvm9j2P477UE1fdU2PCdT/RSYUaz20Np8PDtWEee2dkz2EdgTiOCUupzyMZ6uVf0MjRM/kvDmL4VET0KTcNovMPIb9XNML3Lqn+cn7nw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=lanKLMiB; arc=none smtp.client-ip=80.12.242.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="lanKLMiB" Received: from localhost.localdomain ([90.11.132.44]) by smtp.orange.fr with ESMTPA id 6sdZuvbDkiSFB6sdnuVIhr; Mon, 21 Apr 2025 17:00:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1745247659; bh=eQGxct6K/kcQfnhWWRbqYBef9aZOoyPtucqW7qysfzE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=lanKLMiBzIxfxJmc7t6l6/EY6wAoIPabSGxj0Rr9WYgZ1DtW4LG5/yX6ZzxSPoewd S09Fb58NLEVqgY4HC8Bm2g1mgyf3hdRdwBVtBp5WwwattuEnmc577xr0XWlmhqKsZE OkDE5UxyqqDJh/3D6CMmlhntgaa3A0tWS6biYVZVU9wYbT5kwwdr1QaYHim7jFYdXQ DWI799IXkcymu4XLSVM8x38bXP/WgPivZtP7Ii+jeXM6+KANHyyIcF0Nu8rY7q8amR qWZBjOUnsI+2ideqHM/qbFkNeZTD2LMZo/eC1gtvgDSaAqPEv5RVdzsmqYrn64d8+V evUxhwiBt7ptQ== X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 21 Apr 2025 17:00:59 +0200 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: lee@kernel.org, krzk@kernel.org, alim.akhtar@samsung.com, s.nawrocki@samsung.com, m.szyprowski@samsung.com, ideal.song@samsung.com, beomho.seo@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Krzysztof Kozlowski Subject: [PATCH v2 2/3] mfd: exynos-lpass: Avoid calling exynos_lpass_disable() twice in exynos_lpass_remove() Date: Mon, 21 Apr 2025 17:00:34 +0200 Message-ID: <74d69e8de10308c9855db6d54155a3de4b11abfd.1745247209.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 exynos_lpass_disable() is called twice in the remove function. Remove one of these calls. Fixes: 90f447170c6f ("mfd: exynos-lpass: Add runtime PM support") Signed-off-by: Christophe JAILLET Reviewed-by: Krzysztof Kozlowski --- Compile tested only. Changes in v2: - Add R-b tag v1: https://lore.kernel.org/all/ee6241d024c4cb68622dde9d65d8712016f4205e.1743231856.git.christophe.jaillet@wanadoo.fr/ --- drivers/mfd/exynos-lpass.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mfd/exynos-lpass.c b/drivers/mfd/exynos-lpass.c index 6b95927e99be..a2785ceea8bf 100644 --- a/drivers/mfd/exynos-lpass.c +++ b/drivers/mfd/exynos-lpass.c @@ -141,7 +141,6 @@ static void exynos_lpass_remove(struct platform_device *pdev) { struct exynos_lpass *lpass = platform_get_drvdata(pdev); - exynos_lpass_disable(lpass); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) exynos_lpass_disable(lpass); From patchwork Mon Apr 21 15:00:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 883702 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8999B1CAA79 for ; Mon, 21 Apr 2025 15:01:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745247665; cv=none; b=NepgJZC9goXfnlh58732m3thNpb1oCoSx8QsY+3ZRjEetwEy7kZWYhDIVJn5phz+/YZw34fqSjI5EAu0YchskWdkE8nQwk5bdwpHaqZnLN4jLTArtn/exenmZdPr5aTEe7Py0CfzVIyTp6IFOIZKiAiCB7UL1ZvBCqKh59Y5Rek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745247665; c=relaxed/simple; bh=cqLBh8RKoyai0rDZ0YwoYN2gy4BTTtKqU1IFkhEjhcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HfTxT9kui5Exc3GJ9pgvUO/GcBXr7y+m+oVSIzQgEnjIaPifCBVpiiQxTJ7W1rj2+67zDY28ANnqXylUlIHhwpXTqavYZgW3FSsgSzEQi5pXpMUcBsxgZGefIVB8wnUOaeO8lENPjqsoRnKSfPO+bLTn1jF871xJrTMvz5FHyf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=TMDdinCe; arc=none smtp.client-ip=80.12.242.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="TMDdinCe" Received: from localhost.localdomain ([90.11.132.44]) by smtp.orange.fr with ESMTPA id 6sdZuvbDkiSFB6sdouVInx; Mon, 21 Apr 2025 17:01:00 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1745247660; bh=lDiD6i5z74Svk8ayjFfG3byf2okiGeHcsi0aPvSYhp4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=TMDdinCevHrGlNSotraIExhYUUGQae64ddIrEp6bd0XSCA1+Jk0m7bu3F9FznLspd y22+b3pTuyNWNdACISmjM9k3ZUa3BF0OP1kK5PQJ9Bcq8EKricbp/p1aM6WMKiAAtg XTfdIlF+Vz7/Zj48lwAl4z1ZjfH6Y8wbpGGBQFQhmSiXMaR9f9bSPjyoDmMC4Ow7Cf CGxOamH4eLNFL84D/KzE+HXEqAhDgMBh9RW9DPnEkzcuQgMja6tk68ORJc8iX7qoer ozv6aqr3iIBSAcibvCrDYp0/C8TYO+8d/HShNSpC2xz/+fAhKotH/kNBQG1xWHYD+O PECPhzQemEurQ== X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 21 Apr 2025 17:01:00 +0200 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: lee@kernel.org, krzk@kernel.org, alim.akhtar@samsung.com, s.nawrocki@samsung.com, m.szyprowski@samsung.com, ideal.song@samsung.com, beomho.seo@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2 3/3] mfd: exynos-lpass: Fix another error handling path in exynos_lpass_probe() Date: Mon, 21 Apr 2025 17:00:35 +0200 Message-ID: <69471e839efc0249a504492a8de3497fcdb6a009.1745247209.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If devm_of_platform_populate() fails, some clean-up needs to be done, as already done in the remove function. Add a new devm_add_action_or_reset() to fix the leak in the probe and remove the need of a remove function. Fixes: c695abab2429 ("mfd: Add Samsung Exynos Low Power Audio Subsystem driver") Signed-off-by: Christophe JAILLET Reviewed-by: Krzysztof Kozlowski --- Compile tested only. Changes in v2: - Use a new devm_add_action_or_reset() to fix the leak in the probe and remove the need of a remove function. - Update the commit description accordingly v1: https://lore.kernel.org/all/d224865a16b50498279b044a819e1e187d01bb28.1743231856.git.christophe.jaillet@wanadoo.fr/ --- drivers/mfd/exynos-lpass.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/exynos-lpass.c b/drivers/mfd/exynos-lpass.c index a2785ceea8bf..44797001a432 100644 --- a/drivers/mfd/exynos-lpass.c +++ b/drivers/mfd/exynos-lpass.c @@ -104,11 +104,22 @@ static const struct regmap_config exynos_lpass_reg_conf = { .fast_io = true, }; +static void exynos_lpass_disable_lpass(void *data) +{ + struct platform_device *pdev = data; + struct exynos_lpass *lpass = platform_get_drvdata(pdev); + + pm_runtime_disable(&pdev->dev); + if (!pm_runtime_status_suspended(&pdev->dev)) + exynos_lpass_disable(lpass); +} + static int exynos_lpass_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_lpass *lpass; void __iomem *base_top; + int ret; lpass = devm_kzalloc(dev, sizeof(*lpass), GFP_KERNEL); if (!lpass) @@ -134,16 +145,11 @@ static int exynos_lpass_probe(struct platform_device *pdev) pm_runtime_enable(dev); exynos_lpass_enable(lpass); - return devm_of_platform_populate(dev); -} - -static void exynos_lpass_remove(struct platform_device *pdev) -{ - struct exynos_lpass *lpass = platform_get_drvdata(pdev); + ret = devm_add_action_or_reset(dev, exynos_lpass_disable_lpass, pdev); + if (ret) + return ret; - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - exynos_lpass_disable(lpass); + return devm_of_platform_populate(dev); } static int __maybe_unused exynos_lpass_suspend(struct device *dev) @@ -183,7 +189,6 @@ static struct platform_driver exynos_lpass_driver = { .of_match_table = exynos_lpass_of_match, }, .probe = exynos_lpass_probe, - .remove = exynos_lpass_remove, }; module_platform_driver(exynos_lpass_driver);