dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning
@ 2020-04-11 14:17 Tang Bin
  2020-04-13 14:08 ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Tang Bin @ 2020-04-11 14:17 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, airlied, daniel
  Cc: Shengju Zhang, linux-kernel, dri-devel, Tang Bin

The struct drm_dp_desc contains struct drm_dp_dpcd_ident, and the struct
drm_dp_dpcd_ident contains the array, so zero-initialization requires a 
more couple of braces. In the ARM compiler environment, the compile 
warning pointing it out:
    drivers/gpu/drm/drm_dp_mst_topology.c: In function 'drm_dp_mst_dsc_aux_for_port':
    drivers/gpu/drm/drm_dp_mst_topology.c:5494:9: warning: missing braces around initializer [-Wmissing-braces]
      struct drm_dp_desc desc = { 0 };

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 70c4b7a..4d8d1fd 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -5494,7 +5494,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)
 {
 	struct drm_dp_mst_port *immediate_upstream_port;
 	struct drm_dp_mst_port *fec_port;
-	struct drm_dp_desc desc = { 0 };
+	struct drm_dp_desc desc = { { { 0 } } };
 	u8 endpoint_fec;
 	u8 endpoint_dsc;
 
-- 
2.7.4



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning
  2020-04-11 14:17 [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning Tang Bin
@ 2020-04-13 14:08 ` Alex Deucher
  2020-04-14 11:08   ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2020-04-13 14:08 UTC (permalink / raw)
  To: Tang Bin; +Cc: Dave Airlie, LKML, Maling list - DRI developers, Shengju Zhang

On Mon, Apr 13, 2020 at 5:29 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>
> The struct drm_dp_desc contains struct drm_dp_dpcd_ident, and the struct
> drm_dp_dpcd_ident contains the array, so zero-initialization requires a
> more couple of braces. In the ARM compiler environment, the compile
> warning pointing it out:
>     drivers/gpu/drm/drm_dp_mst_topology.c: In function 'drm_dp_mst_dsc_aux_for_port':
>     drivers/gpu/drm/drm_dp_mst_topology.c:5494:9: warning: missing braces around initializer [-Wmissing-braces]
>       struct drm_dp_desc desc = { 0 };
>

This seems to vary based on compilers.  Maybe a memset would be better.

Alex

> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 70c4b7a..4d8d1fd 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -5494,7 +5494,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)
>  {
>         struct drm_dp_mst_port *immediate_upstream_port;
>         struct drm_dp_mst_port *fec_port;
> -       struct drm_dp_desc desc = { 0 };
> +       struct drm_dp_desc desc = { { { 0 } } };
>         u8 endpoint_fec;
>         u8 endpoint_dsc;
>
> --
> 2.7.4
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning
  2020-04-13 14:08 ` Alex Deucher
@ 2020-04-14 11:08   ` Jani Nikula
  2020-04-14 12:39     ` Tang Bin
  0 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2020-04-14 11:08 UTC (permalink / raw)
  To: Alex Deucher, Tang Bin
  Cc: Dave Airlie, LKML, Maling list - DRI developers, Shengju Zhang

On Mon, 13 Apr 2020, Alex Deucher <alexdeucher@gmail.com> wrote:
> On Mon, Apr 13, 2020 at 5:29 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>>
>> The struct drm_dp_desc contains struct drm_dp_dpcd_ident, and the struct
>> drm_dp_dpcd_ident contains the array, so zero-initialization requires a
>> more couple of braces. In the ARM compiler environment, the compile
>> warning pointing it out:
>>     drivers/gpu/drm/drm_dp_mst_topology.c: In function 'drm_dp_mst_dsc_aux_for_port':
>>     drivers/gpu/drm/drm_dp_mst_topology.c:5494:9: warning: missing braces around initializer [-Wmissing-braces]
>>       struct drm_dp_desc desc = { 0 };
>>
>
> This seems to vary based on compilers.  Maybe a memset would be better.

= {}; will do the trick.

BR,
Jani.


>
> Alex
>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
>> ---
>>  drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
>> index 70c4b7a..4d8d1fd 100644
>> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
>> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
>> @@ -5494,7 +5494,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)
>>  {
>>         struct drm_dp_mst_port *immediate_upstream_port;
>>         struct drm_dp_mst_port *fec_port;
>> -       struct drm_dp_desc desc = { 0 };
>> +       struct drm_dp_desc desc = { { { 0 } } };
>>         u8 endpoint_fec;
>>         u8 endpoint_dsc;
>>
>> --
>> 2.7.4
>>
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning
  2020-04-14 11:08   ` Jani Nikula
@ 2020-04-14 12:39     ` Tang Bin
  2020-04-14 13:00       ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Tang Bin @ 2020-04-14 12:39 UTC (permalink / raw)
  To: Jani Nikula, Alex Deucher; +Cc: Dave Airlie, LKML, Maling list - DRI developers


[-- Attachment #1.1: Type: text/plain, Size: 1251 bytes --]

Hi Jani:

On 2020/4/14 19:08, Jani Nikula wrote:
> On Mon, 13 Apr 2020, Alex Deucher <alexdeucher@gmail.com> wrote:
>> On Mon, Apr 13, 2020 at 5:29 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>>> The struct drm_dp_desc contains struct drm_dp_dpcd_ident, and the struct
>>> drm_dp_dpcd_ident contains the array, so zero-initialization requires a
>>> more couple of braces. In the ARM compiler environment, the compile
>>> warning pointing it out:
>>>      drivers/gpu/drm/drm_dp_mst_topology.c: In function 'drm_dp_mst_dsc_aux_for_port':
>>>      drivers/gpu/drm/drm_dp_mst_topology.c:5494:9: warning: missing braces around initializer [-Wmissing-braces]
>>>        struct drm_dp_desc desc = { 0 };
>>>
>> This seems to vary based on compilers.  Maybe a memset would be better.
> = {}; will do the trick.

Yes, I had already confirmed this on the hardware before I mentioned the 
patch: '{}' or '{{{0}}}' are the same result in this file.But someone 
may query '{}' could not initialize all members, that's why I brought 
'{{{0}}}' up. Both initializations are validated on the hardware.

My environment:

   PC : Ubuntu 16.04

   Hardware : I.MX6ULL

   Tool Chain : arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2017.01) 4.9.4


Thanks

Tang Bin


[-- Attachment #1.2: Type: text/html, Size: 4886 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning
  2020-04-14 12:39     ` Tang Bin
@ 2020-04-14 13:00       ` Jani Nikula
  0 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2020-04-14 13:00 UTC (permalink / raw)
  To: Tang Bin, Alex Deucher; +Cc: Dave Airlie, LKML, Maling list - DRI developers

On Tue, 14 Apr 2020, Tang Bin <tangbin@cmss.chinamobile.com> wrote:
> But someone may query '{}' could not initialize all members, that's
> why I brought '{{{0}}}' up.

{} *does* initialize everything. What are you trying to say?

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-15  7:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-11 14:17 [PATCH] drm/dp_mst: Fix drm_dp_mst_topology.c selftest compilation warning Tang Bin
2020-04-13 14:08 ` Alex Deucher
2020-04-14 11:08   ` Jani Nikula
2020-04-14 12:39     ` Tang Bin
2020-04-14 13:00       ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).