Skip to content

Commit 826096d

Browse files
nathanchanceSaeed Mahameed
authored andcommitted
mlx5: Remove uninitialized use of key in mlx5_core_create_mkey
Clang warns: ../drivers/net/ethernet/mellanox/mlx5/core/mr.c:63:21: warning: variable 'key' is uninitialized when used here [-Wuninitialized] mkey_index, key, mkey->key); ^~~ ../drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h:54:6: note: expanded from macro 'mlx5_core_dbg' ##__VA_ARGS__) ^~~~~~~~~~~ ../include/linux/dev_printk.h:114:39: note: expanded from macro 'dev_dbg' dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ ../include/linux/dynamic_debug.h:158:19: note: expanded from macro 'dynamic_dev_dbg' dev, fmt, ##__VA_ARGS__) ^~~~~~~~~~~ ../include/linux/dynamic_debug.h:143:56: note: expanded from macro '_dynamic_func_call' __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) ^~~~~~~~~~~ ../include/linux/dynamic_debug.h:125:15: note: expanded from macro '__dynamic_func_call' func(&id, ##__VA_ARGS__); \ ^~~~~~~~~~~ ../drivers/net/ethernet/mellanox/mlx5/core/mr.c:47:8: note: initialize the variable 'key' to silence this warning u8 key; ^ = '\0' 1 warning generated. key's initialization was removed in commit fc6a9f8 ("{IB,net}/mlx5: Assign mkey variant in mlx5_ib only") but its use was not fully removed. Remove it now so that there is no more warning. Fixes: fc6a9f8 ("{IB,net}/mlx5: Assign mkey variant in mlx5_ib only") Link: ClangBuiltLinux/linux#932 Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent a3cfdd3 commit 826096d

File tree

1 file changed

+1
-3
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+1
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/mr.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
4444
u32 mkey_index;
4545
void *mkc;
4646
int err;
47-
u8 key;
4847

4948
MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY);
5049

@@ -59,8 +58,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
5958
mkey->key |= mlx5_idx_to_mkey(mkey_index);
6059
mkey->pd = MLX5_GET(mkc, mkc, pd);
6160

62-
mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n",
63-
mkey_index, key, mkey->key);
61+
mlx5_core_dbg(dev, "out 0x%x, mkey 0x%x\n", mkey_index, mkey->key);
6462
return 0;
6563
}
6664
EXPORT_SYMBOL(mlx5_core_create_mkey);

0 commit comments

Comments
 (0)