[2/2] drm/display/dp_mst: Fix drm_dp_mst_add_affected_dsc_crtcs() return code

Message ID 20221104235926.302883-3-lyude@redhat.com
State New
Headers
Series [1/2] drm/amdgpu/mst: Stop ignoring error codes and deadlocking |

Commit Message

Lyude Paul Nov. 4, 2022, 11:59 p.m. UTC
  Looks like that we're accidentally dropping a pretty important return code
here. For some reason, we just return -EINVAL if we fail to get the MST
topology state. This is wrong: error codes are important and should never
be squashed without being handled, which here seems to have the potential
to cause a deadlock.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: 8ec046716ca8 ("drm/dp_mst: Add helper to trigger modeset on affected DSC MST CRTCs")
Cc: <stable@vger.kernel.org> # v5.6+
---
 drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Lin, Wayne Nov. 9, 2022, 9:51 a.m. UTC | #1
[AMD Official Use Only - General]

Hi Lyude,

It LGTM. Feel free to add 
Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>

> -----Original Message-----
> From: Lyude Paul <lyude@redhat.com>
> Sent: Saturday, November 5, 2022 7:59 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: stable@vger.kernel.org; David Airlie <airlied@gmail.com>; Daniel Vetter
> <daniel@ffwll.ch>; Jani Nikula <jani.nikula@intel.com>; Thomas
> Zimmermann <tzimmermann@suse.de>; Lin, Wayne
> <Wayne.Lin@amd.com>; Imre Deak <imre.deak@intel.com>; Mikita Lipski
> <mikita.lipski@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; open list:DRM DRIVERS <dri-
> devel@lists.freedesktop.org>; open list <linux-kernel@vger.kernel.org>
> Subject: [PATCH 2/2] drm/display/dp_mst: Fix
> drm_dp_mst_add_affected_dsc_crtcs() return code
> 
> Looks like that we're accidentally dropping a pretty important return code
> here. For some reason, we just return -EINVAL if we fail to get the MST
> topology state. This is wrong: error codes are important and should never be
> squashed without being handled, which here seems to have the potential to
> cause a deadlock.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Fixes: 8ec046716ca8 ("drm/dp_mst: Add helper to trigger modeset on
> affected DSC MST CRTCs")
> Cc: <stable@vger.kernel.org> # v5.6+
> ---
>  drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index ecd22c038c8c0..51a46689cda70 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> @@ -5186,7 +5186,7 @@ int drm_dp_mst_add_affected_dsc_crtcs(struct
> drm_atomic_state *state, struct drm
>  	mst_state = drm_atomic_get_mst_topology_state(state, mgr);
> 
>  	if (IS_ERR(mst_state))
> -		return -EINVAL;
> +		return PTR_ERR(mst_state);
> 
>  	list_for_each_entry(pos, &mst_state->payloads, next) {
> 
> --
> 2.37.3
  

Patch

diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
index ecd22c038c8c0..51a46689cda70 100644
--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
@@ -5186,7 +5186,7 @@  int drm_dp_mst_add_affected_dsc_crtcs(struct drm_atomic_state *state, struct drm
 	mst_state = drm_atomic_get_mst_topology_state(state, mgr);
 
 	if (IS_ERR(mst_state))
-		return -EINVAL;
+		return PTR_ERR(mst_state);
 
 	list_for_each_entry(pos, &mst_state->payloads, next) {