OSDN Git Service

devlink: Clear whole devlink_flash_notify struct
authorLeon Romanovsky <leonro@nvidia.com>
Sat, 14 Aug 2021 09:57:30 +0000 (12:57 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 14 Aug 2021 12:59:10 +0000 (13:59 +0100)
The { 0 } doesn't clear all fields in the struct, but tells to the
compiler to set all fields to zero and doesn't touch any sub-fields
if they exists.

The {} is an empty initialiser that instructs to fully initialize whole
struct including sub-fields, which is error-prone for future
devlink_flash_notify extensions.

Fixes: 6700acc5f1fe ("devlink: collect flash notify params into a struct")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/devlink.c

index d218f57..a856ae4 100644 (file)
@@ -4169,7 +4169,7 @@ out_free_msg:
 
 static void devlink_flash_update_begin_notify(struct devlink *devlink)
 {
-       struct devlink_flash_notify params = { 0 };
+       struct devlink_flash_notify params = {};
 
        __devlink_flash_update_notify(devlink,
                                      DEVLINK_CMD_FLASH_UPDATE,
@@ -4178,7 +4178,7 @@ static void devlink_flash_update_begin_notify(struct devlink *devlink)
 
 static void devlink_flash_update_end_notify(struct devlink *devlink)
 {
-       struct devlink_flash_notify params = { 0 };
+       struct devlink_flash_notify params = {};
 
        __devlink_flash_update_notify(devlink,
                                      DEVLINK_CMD_FLASH_UPDATE_END,