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 <[email protected]>
Signed-off-by: Shengju Zhang <[email protected]>
---
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
On Mon, Apr 13, 2020 at 5:29 AM Tang Bin <[email protected]> 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 <[email protected]>
> Signed-off-by: Shengju Zhang <[email protected]>
> ---
> 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
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
On Mon, 13 Apr 2020, Alex Deucher <[email protected]> wrote:
> On Mon, Apr 13, 2020 at 5:29 AM Tang Bin <[email protected]> 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 <[email protected]>
>> Signed-off-by: Shengju Zhang <[email protected]>
>> ---
>> 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
>> [email protected]
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Jani Nikula, Intel Open Source Graphics Center
On Tue, 14 Apr 2020, Tang Bin <[email protected]> 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