diff options
author | Leon Romanovsky <leonro@nvidia.com> | 2023-01-31 15:31:57 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-02-01 21:04:09 -0800 |
commit | 028fb19c6ba743ed308ba99ac325afa968795e0f (patch) | |
tree | 0e9a952b6db48a9c87c98714c6aa6a2540bc5fd0 /net/dsa/master.c | |
parent | 62e395f82d04510b0f86e5e603e29412be88596f (diff) | |
download | linux-028fb19c6ba743ed308ba99ac325afa968795e0f.tar.gz linux-028fb19c6ba743ed308ba99ac325afa968795e0f.tar.bz2 linux-028fb19c6ba743ed308ba99ac325afa968795e0f.zip |
netlink: provide an ability to set default extack message
In netdev common pattern, extack pointer is forwarded to the drivers
to be filled with error message. However, the caller can easily
overwrite the filled message.
Instead of adding multiple "if (!extack->_msg)" checks before any
NL_SET_ERR_MSG() call, which appears after call to the driver, let's
add new macro to common code.
[1] https://lore.kernel.org/all/Y9Irgrgf3uxOjwUm@unreal
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/6993fac557a40a1973dfa0095107c3d03d40bec1.1675171790.git.leon@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa/master.c')
-rw-r--r-- | net/dsa/master.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/dsa/master.c b/net/dsa/master.c index 26d90140d271..1507b8cdb360 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -464,9 +464,7 @@ int dsa_master_lag_setup(struct net_device *lag_dev, struct dsa_port *cpu_dp, err = dsa_port_lag_join(cpu_dp, lag_dev, uinfo, extack); if (err) { - if (extack && !extack->_msg) - NL_SET_ERR_MSG_MOD(extack, - "CPU port failed to join LAG"); + NL_SET_ERR_MSG_WEAK_MOD(extack, "CPU port failed to join LAG"); goto out_master_teardown; } |