[PATCH] drm/bridge: cdns-mhdp8546: unlock on error in cdns_mhdp_atomic_enable()

Dan Carpenter posted 1 patch 9 months, 1 week ago
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] drm/bridge: cdns-mhdp8546: unlock on error in cdns_mhdp_atomic_enable()
Posted by Dan Carpenter 9 months, 1 week ago
Unlock and reschedule if drm_mode_duplicate() fails.  In real life, the
drm_mode_duplicate() function does a small allocation and those never
fail in current kernels.  So this doesn't really affect runtime but
the missing unlock triggers a static checker warning.

Fixes: 935a92a1c400 ("drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
index b431e7efd1f0..172039fbfab8 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
@@ -1984,8 +1984,10 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge,
 	mhdp_state = to_cdns_mhdp_bridge_state(new_state);
 
 	mhdp_state->current_mode = drm_mode_duplicate(bridge->dev, mode);
-	if (!mhdp_state->current_mode)
-		return;
+	if (!mhdp_state->current_mode) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	drm_mode_set_name(mhdp_state->current_mode);
 
-- 
2.47.2
Re: [PATCH] drm/bridge: cdns-mhdp8546: unlock on error in cdns_mhdp_atomic_enable()
Posted by Dmitry Baryshkov 9 months, 1 week ago
On Wed, Apr 30, 2025 at 11:02:14AM +0300, Dan Carpenter wrote:
> Unlock and reschedule if drm_mode_duplicate() fails.  In real life, the
> drm_mode_duplicate() function does a small allocation and those never
> fail in current kernels.  So this doesn't really affect runtime but
> the missing unlock triggers a static checker warning.
> 
> Fixes: 935a92a1c400 ("drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

-- 
With best wishes
Dmitry