Skip to content

Commit

Permalink
devlink: Clear whole devlink_flash_notify struct
Browse files Browse the repository at this point in the history
[ Upstream commit ed43fba ]

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: 6700acc ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rleon authored and gregkh committed Sep 15, 2021
1 parent 1b703f4 commit 5eb9d59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/devlink.c
Expand Up @@ -4117,7 +4117,7 @@ static void __devlink_flash_update_notify(struct devlink *devlink,

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,
Expand All @@ -4126,7 +4126,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,
Expand Down

0 comments on commit 5eb9d59

Please sign in to comment.