[v2] drm/amd/display: Initialize stream_update with memset

Submitted by Kazlauskas, Nicholas on March 22, 2019, 1:59 p.m.

Details

Message ID 20190322135932.29100-1-nicholas.kazlauskas@amd.com
State New
Headers show
Series "drm/amd/display: Initialize stream_update with memset" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Kazlauskas, Nicholas March 22, 2019, 1:59 p.m.
The brace initialization used here generates warnings on some
compilers. For example, on GCC 4.9:

[...] In function ‘dm_determine_update_type_for_commit’:
[...] error: missing braces around initializer [-Werror=missing-braces]
   struct dc_stream_update stream_update = { 0 };
          ^

Use memset to make this more portable.

v2: Specify the compiler / diagnostic in the commit message (Paul)

Cc: Sun peng Li <Sunpeng.Li@amd.com>
Cc: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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 5b7a85e28fab..9cdd52edfc3d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5982,7 +5982,9 @@  dm_determine_update_type_for_commit(struct dc *dc,
 	}
 
 	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
-		struct dc_stream_update stream_update = { 0 };
+		struct dc_stream_update stream_update;
+
+		memset(&stream_update, 0, sizeof(stream_update));
 
 		new_dm_crtc_state = to_dm_crtc_state(new_crtc_state);
 		old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);

Comments

On 2019-03-22 9:59 a.m., Nicholas Kazlauskas wrote:
> The brace initialization used here generates warnings on some

> compilers. For example, on GCC 4.9:

> 

> [...] In function ‘dm_determine_update_type_for_commit’:

> [...] error: missing braces around initializer [-Werror=missing-braces]

>     struct dc_stream_update stream_update = { 0 };

>            ^

> 

> Use memset to make this more portable.

> 

> v2: Specify the compiler / diagnostic in the commit message (Paul)

> 

> Cc: Sun peng Li <Sunpeng.Li@amd.com>

> Cc: Harry Wentland <Harry.Wentland@amd.com>

> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>


Reviewed-by: Leo Li <sunpeng.li@amd.com>


> ---

>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-

>   1 file changed, 3 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 5b7a85e28fab..9cdd52edfc3d 100644

> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

> @@ -5982,7 +5982,9 @@ dm_determine_update_type_for_commit(struct dc *dc,

>   	}

>   

>   	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {

> -		struct dc_stream_update stream_update = { 0 };

> +		struct dc_stream_update stream_update;

> +

> +		memset(&stream_update, 0, sizeof(stream_update));

>   

>   		new_dm_crtc_state = to_dm_crtc_state(new_crtc_state);

>   		old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);

>