]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpu: cdns-mhdp8546: fix call balance of mhdp->clk handling routines
authorVitalii Mordan <mordan@ispras.ru>
Fri, 14 Feb 2025 15:46:32 +0000 (18:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:14 +0000 (14:39 +0200)
commit2a07eab05d9d9fbd47d49523c86fb14aea848652
tree6e4f492b50da4decabd974d739cce33292289c84
parentd5eb8e347905ab17788a7903fa1d3d06747355f5
gpu: cdns-mhdp8546: fix call balance of mhdp->clk handling routines

[ Upstream commit f65727be3fa5f252c8d982d15023aab8255ded19 ]

If the clock mhdp->clk was not enabled in cdns_mhdp_probe(), it should not
be disabled in any path.

The return value of clk_prepare_enable() is not checked. If mhdp->clk was
not enabled, it may be disabled in the error path of cdns_mhdp_probe()
(e.g., if cdns_mhdp_load_firmware() fails) or in cdns_mhdp_remove() after
a successful cdns_mhdp_probe() call.

Use the devm_clk_get_enabled() helper function to ensure proper call
balance for mhdp->clk.

Found by Linux Verification Center (linuxtesting.org) with Klever.

Fixes: fb43aa0acdfd ("drm: bridge: Add support for Cadence MHDP8546 DPI/DP bridge")
Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250214154632.1907425-1-mordan@ispras.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c