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 62D7030BF69; Wed, 25 Feb 2026 06:57:46 +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=1772002666; cv=none; b=UoTFYHAdUrWPJPaPSUTnvsMf6a3iqzerqOMocogHdaS6bXdF+dFJz/6l0oOcqMvua/JDDyzQoe7phdaNEP9YBB93j3Go7nr78rUSqSNd8M3OtrixzhxEQMh0EzuBiu4GNz4L2yKXgDqIxzetl5Pl0+6z+YlLTxNg6yC14sNeK3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772002666; c=relaxed/simple; bh=ZZdFfpldocfyrRFQyM3t/5jNT5pxAYdSYGwruxw8Icg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NqlQWp6+Ph+/Q48ZgqfIG45vgkfJOiTmdw5HR8NmCkKQvLaDylDcklaT3op4K5mDcU8Dnk1o/vWz822EKuqXjo7OcjfP2RnFAvMLGz1gnKnQHaYx5fwIiPeeOn8t2w0LhCXeeJf0gnPjN15R4spELARZ8anxKi2jfeUY/cVHSiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rpc9Q6GJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rpc9Q6GJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D2E7C116D0; Wed, 25 Feb 2026 06:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1772002666; bh=ZZdFfpldocfyrRFQyM3t/5jNT5pxAYdSYGwruxw8Icg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rpc9Q6GJmvN74zg4EP1qmqoHp9FFAiXUhQfOSxYb0FQC1nZbDCOE3PiIW25jiO7ls u50IzX36EErm5pqTGboOutgwYx2CcgCLOUaKoK7OYgEQKFgD5j7+c39GFrF1PDEdpl mEPSVvO+YzthypAVXR2gBMj/O+DMv5ZxtCOVR4Xo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haotian Zhang , AngeloGioacchino Del Regno , Stephen Boyd , Sasha Levin Subject: [PATCH 6.18 447/641] clk: mediatek: Fix error handling in runtime PM setup Date: Tue, 24 Feb 2026 17:22:53 -0800 Message-ID: <20260225012359.353081589@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260225012348.915798704@linuxfoundation.org> References: <20260225012348.915798704@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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haotian Zhang [ Upstream commit aa2ad19210a6a444111bce55e8b69579f29318fb ] devm_pm_runtime_enable() can fail due to memory allocation. The current code ignores its return value, and when pm_runtime_resume_and_get() fails, it returns directly without unmapping the shared_io region. Add error handling for devm_pm_runtime_enable(). Reorder cleanup labels to properly unmap shared_io on pm_runtime_resume_and_get() failure. Fixes: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe") Signed-off-by: Haotian Zhang Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mtk.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 19cd27941747a..deafe55a96cb1 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -497,14 +497,16 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, if (mcd->need_runtime_pm) { - devm_pm_runtime_enable(&pdev->dev); + r = devm_pm_runtime_enable(&pdev->dev); + if (r) + goto unmap_io; /* * Do a pm_runtime_resume_and_get() to workaround a possible * deadlock between clk_register() and the genpd framework. */ r = pm_runtime_resume_and_get(&pdev->dev); if (r) - return r; + goto unmap_io; } /* Calculate how many clk_hw_onecell_data entries to allocate */ @@ -618,11 +620,11 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, free_data: mtk_free_clk_data(clk_data); free_base: - if (mcd->shared_io && base) - iounmap(base); - if (mcd->need_runtime_pm) pm_runtime_put(&pdev->dev); +unmap_io: + if (mcd->shared_io && base) + iounmap(base); return r; } -- 2.51.0