mlx5: vdpa: fix possible uninitialized var
Subsystems (2)
PATCH 1/1 mlx5: vdpa: fix possible uninitialized var
Upstream: posted
When compiling with -Werror=maybe-uninitialized, gcc may complains the possible uninitialized umem. Fix that.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +3 -0
@@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueuecase 3 : umem = &mvq->umem3;break ; +default : +WARN (1 ,"unsupported umem num %d\n" , num); +return ; }MLX5_SET (destroy_umem_in, in, opcode,MLX5_CMD_OP_DESTROY_UMEM );
Signature · 6 lines
2.25.1 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 15 lines · Jason Wang
Upstream: posted
When compiling with -Werror=maybe-uninitialized, gcc may complains the possible uninitialized umem. Fix that.
Signed-off-by Jason Wang <[email protected]>--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+)drivers/vdpa/mlx5/net/mlx5_vnet.c +0
-0
drivers/vdpa/mlx5/net/mlx5_vnet.c static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue · line 714
Quoted 9 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +3
-0@@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueuecase 3 : umem = &mvq->umem3;break ; +default : +WARN (1 ,"unsupported umem num %d\n" , num); +return ; }MLX5_SET (destroy_umem_in, in, opcode,MLX5_CMD_OP_DESTROY_UMEM );
Since the "default" case will never be executed, maybe it's better to just change "case 3:" to "default:" and avoid the WARN().
Quoted 3 lines
Signature · 1 line
2.25.1
Quoted 24 lines · Eli Cohen
Quoted 23 lines · Jason Wang
Upstream: posted
When compiling with -Werror=maybe-uninitialized, gcc may complains the possible uninitialized umem. Fix that.
Signed-off-by Jason Wang <[email protected]>--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+)drivers/vdpa/mlx5/net/mlx5_vnet.c +3
-0@@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueuecase 3 : umem = &mvq->umem3;break ; +default : +WARN (1 ,"unsupported umem num %d\n" , num); +return ; }
Quoted 3 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue · line 714
Quoted 1 line
drivers/vdpa/mlx5/net/mlx5_vnet.c +0
-0MLX5_SET (destroy_umem_in, in, opcode,MLX5_CMD_OP_DESTROY_UMEM );Since the "default" case will never be executed, maybe it's better to just change "case 3:" to "default:" and avoid the
WARN().
Fine with me. Will do that in V3.
Thanks
Quoted 4 lines
Quoted 4 lines
Signature · 2 lines
-- 2.25.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization