[PATCH] drm/amdgpu/display: Fix an error handling path in 'dm_update_crtc_state()'

2020-03-09 Thread Christophe JAILLET
'dc_stream_release()' may be called twice. Once here, and once below in the
error handling path if we branch to the 'fail' label.

Set 'new_stream' to NULL, once released to avoid the duplicated release
function call.

Signed-off-by: Christophe JAILLET 
---
Maybe the 'goto fail' at line 7745 should be turned into a 'return ret'
instead. Could be clearer.

No Fixes tag provided because I've not been able to dig deep enough in the
git history.
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 97c1b01c0fc1..9d7773a77c4f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7704,8 +7704,10 @@ static int dm_update_crtc_state(struct 
amdgpu_display_manager *dm,
 
 skip_modeset:
/* Release extra reference */
-   if (new_stream)
-dc_stream_release(new_stream);
+   if (new_stream) {
+   dc_stream_release(new_stream);
+   new_stream = NULL;
+   }
 
/*
 * We want to do dc stream updates that do not require a
-- 
2.20.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


AW: [PATCH] drm/amdgpu/display: Fix an error handling path in 'dm_update_crtc_state()'

2020-03-09 Thread Walter Harms



Von: kernel-janitors-ow...@vger.kernel.org 
 im Auftrag von Christophe JAILLET 

Gesendet: Sonntag, 8. März 2020 10:26
An: harry.wentl...@amd.com; sunpeng...@amd.com; alexander.deuc...@amd.com; 
christian.koe...@amd.com; david1.z...@amd.com; airl...@linux.ie; 
dan...@ffwll.ch; nicholas.kazlaus...@amd.com; bhawanpreet.la...@amd.com; 
mario.kleiner...@gmail.com; david.fran...@amd.com
Cc: amd-gfx@lists.freedesktop.org; dri-de...@lists.freedesktop.org; 
linux-ker...@vger.kernel.org; kernel-janit...@vger.kernel.org; Christophe 
JAILLET
Betreff: [PATCH] drm/amdgpu/display: Fix an error handling path in 
'dm_update_crtc_state()'

'dc_stream_release()' may be called twice. Once here, and once below in the
error handling path if we branch to the 'fail' label.

Set 'new_stream' to NULL, once released to avoid the duplicated release
function call.

Signed-off-by: Christophe JAILLET 
---
Maybe the 'goto fail' at line 7745 should be turned into a 'return ret'
instead. Could be clearer.

No Fixes tag provided because I've not been able to dig deep enough in the
git history.
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 97c1b01c0fc1..9d7773a77c4f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7704,8 +7704,10 @@ static int dm_update_crtc_state(struct 
amdgpu_display_manager *dm,

 skip_modeset:
/* Release extra reference */
-   if (new_stream)
-dc_stream_release(new_stream);
+   if (new_stream) {
+   dc_stream_release(new_stream);
+   new_stream = NULL;
+   }


dc_stream_release() is NULL-checked, so the if can be dropped.

re,
 wh

/*
 * We want to do dc stream updates that do not require a
--
2.20.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu/display: Fix an error handling path in 'dm_update_crtc_state()'

2020-03-12 Thread Dan Carpenter
On Mon, Mar 09, 2020 at 08:24:04AM +, Walter Harms wrote:
> 
> 
> Von: kernel-janitors-ow...@vger.kernel.org 
>  im Auftrag von Christophe JAILLET 
> 
> Gesendet: Sonntag, 8. März 2020 10:26
> An: harry.wentl...@amd.com; sunpeng...@amd.com; alexander.deuc...@amd.com; 
> christian.koe...@amd.com; david1.z...@amd.com; airl...@linux.ie; 
> dan...@ffwll.ch; nicholas.kazlaus...@amd.com; bhawanpreet.la...@amd.com; 
> mario.kleiner...@gmail.com; david.fran...@amd.com
> Cc: amd-gfx@lists.freedesktop.org; dri-de...@lists.freedesktop.org; 
> linux-ker...@vger.kernel.org; kernel-janit...@vger.kernel.org; Christophe 
> JAILLET
> Betreff: [PATCH] drm/amdgpu/display: Fix an error handling path in 
> 'dm_update_crtc_state()'
> 
> 'dc_stream_release()' may be called twice. Once here, and once below in the
> error handling path if we branch to the 'fail' label.
> 
> Set 'new_stream' to NULL, once released to avoid the duplicated release
> function call.
> 
> Signed-off-by: Christophe JAILLET 
> ---
> Maybe the 'goto fail' at line 7745 should be turned into a 'return ret'
> instead. Could be clearer.
> 
> No Fixes tag provided because I've not been able to dig deep enough in the
> git history.
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 97c1b01c0fc1..9d7773a77c4f 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7704,8 +7704,10 @@ static int dm_update_crtc_state(struct 
> amdgpu_display_manager *dm,
> 
>  skip_modeset:
> /* Release extra reference */
> -   if (new_stream)
> -dc_stream_release(new_stream);
> +   if (new_stream) {
> +   dc_stream_release(new_stream);
> +   new_stream = NULL;
> +   }
> 
> 
> dc_stream_release() is NULL-checked, so the if can be dropped.
> 
> re,
>  wh

Walter, it's really hard to separate your reply from the quoted email.
What's going on with that?  Could you configure your email client to
use "> " for the quoted bit?

regards,
dan carpenter

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx