Re: [PATCH 4/6] drm/amd/amdgpu: Check stream in amdgpu_dm_commit_planes

2019-06-25 Thread Kazlauskas, Nicholas
On 6/24/19 11:15 AM, Ernst Sjöstrand wrote:
> Reported by smatch:
> amdgpu_dm.c:5637 amdgpu_dm_commit_planes() error: we previously assumed 
> 'acrtc_state->stream' could be null
> This seems to be checked for null pretty consistently elsewhere.
> 
> Signed-off-by: Ernst Sjöstrand 

This is already reviewed and merged, but this NULL check is actually 
unnecessary. This function doesn't run in the new_crtc_state->stream is 
NULL.

Technically the behavior does change inside 
dc_commit_updates_for_stream. We don't actually deference the stream 
anywhere as far as I can tell, but we do an prepare/optimize bandwidth 
and a state swap. The missing state swap would matter here, but once 
again, we don't actually run this function at all.

All these checks should probably just be dropped.

Nicholas Kazlauskas

> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 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 58d7bbc5ada7..360b31a5c028 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5669,7 +5669,8 @@ static void amdgpu_dm_commit_planes(struct 
> drm_atomic_state *state,
>   }
>   
>   /* Update the planes if changed or disable if we don't have any. */
> - if (planes_count || acrtc_state->active_planes == 0) {
> + if ((planes_count || acrtc_state->active_planes == 0) &&
> + acrtc_state->stream) {
>   if (new_pcrtc_state->mode_changed) {
>   bundle->stream_update.src = acrtc_state->stream->src;
>   bundle->stream_update.dst = acrtc_state->stream->dst;
> 

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

[PATCH 4/6] drm/amd/amdgpu: Check stream in amdgpu_dm_commit_planes

2019-06-24 Thread Ernst Sjöstrand
Reported by smatch:
amdgpu_dm.c:5637 amdgpu_dm_commit_planes() error: we previously assumed 
'acrtc_state->stream' could be null
This seems to be checked for null pretty consistently elsewhere.

Signed-off-by: Ernst Sjöstrand 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 58d7bbc5ada7..360b31a5c028 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5669,7 +5669,8 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
}
 
/* Update the planes if changed or disable if we don't have any. */
-   if (planes_count || acrtc_state->active_planes == 0) {
+   if ((planes_count || acrtc_state->active_planes == 0) &&
+   acrtc_state->stream) {
if (new_pcrtc_state->mode_changed) {
bundle->stream_update.src = acrtc_state->stream->src;
bundle->stream_update.dst = acrtc_state->stream->dst;
-- 
2.20.1

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