diff mbox series

[iproute2] rdma: stat: fix return code

Message ID 9cc2c9bdb7bf7c235bf2e7a63b9e13b0cdae58c5.1618750205.git.aclaudi@redhat.com (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers show
Series [iproute2] rdma: stat: fix return code | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Andrea Claudi April 18, 2021, 12:56 p.m. UTC
libmnl defines MNL_CB_OK as 1 and MNL_CB_ERROR as -1. rdma uses these
return codes, and stat_qp_show_parse_cb() should do the same.

Fixes: 16ce4d23661a ("rdma: stat: initialize ret in stat_qp_show_parse_cb()")
Reported-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 rdma/stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky April 18, 2021, 1:25 p.m. UTC | #1
On Sun, Apr 18, 2021 at 02:56:30PM +0200, Andrea Claudi wrote:
> libmnl defines MNL_CB_OK as 1 and MNL_CB_ERROR as -1. rdma uses these
> return codes, and stat_qp_show_parse_cb() should do the same.
> 
> Fixes: 16ce4d23661a ("rdma: stat: initialize ret in stat_qp_show_parse_cb()")
> Reported-by: Leon Romanovsky <leon@kernel.org>
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
>  rdma/stat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks,
Acked-by: Leon Romanovsky <leonro@nvidia.com>
diff mbox series

Patch

diff --git a/rdma/stat.c b/rdma/stat.c
index 3abedae7..8edf7bf1 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -307,7 +307,7 @@  static int stat_qp_show_parse_cb(const struct nlmsghdr *nlh, void *data)
 	struct rd *rd = data;
 	const char *name;
 	uint32_t idx;
-	int ret = 0;
+	int ret = MNL_CB_OK;
 
 	mnl_attr_parse(nlh, 0, rd_attr_cb, tb);
 	if (!tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !tb[RDMA_NLDEV_ATTR_DEV_NAME] ||