librdmacm compiler warning fixes
cover librdmacm compiler warning fixes
This is a small series of four patches addressing issues I noticed while analyzing the warnings reported by a recent gcc version. These patches do not change the behavior of librdmacm. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/4 acm: Remove the unused variable 'pri_path'
The variable 'pri_path' is assigned a value but is never used. This triggers the following compiler warning:
src/acm.c:301:26: warning: variable 'pri_path' set but not used [-Wunused-but-set-variable]
Hence remove this variable.
--- src/acm.c | 4 ---- 1 file changed, 4 deletions(-)
src/acm.c +0 -4
@@ -297,7 +297,6 @@ static void ucma_ib_save_resp(struct rdma_addrinfo *rai, struct acm_msg *msg) {struct acm_ep_addr_data *ep_data;struct ibv_path_data *path_data =NULL ; -struct ibv_path_record *pri_path =NULL ;struct sockaddr_in *sin;struct sockaddr_in6 *sin6;int i, cnt, path_cnt =0 ;
@@ -311,9 +310,6 @@ static void ucma_ib_save_resp(struct rdma_addrinfo *rai, struct acm_msg *msg)if (!path_data) path_data = (struct ibv_path_data *) ep_data; path_cnt++; -if (ep_data->flags | - (IBV_PATH_FLAG_PRIMARY |IBV_PATH_FLAG_OUTBOUND )) - pri_path = &path_data[i].path;break ;case ACM_EP_INFO_ADDRESS_IP :if (!(ep_data->flags &ACM_EP_FLAG_SOURCE ) || rai->ai_src_len)
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/4 cma: Remove the unused variable 'id_priv'
In reply to a message not in the archiveThe variable 'id_priv' is assigned a value but is never used. This triggers the following compiler warning:
src/cma.c:1178:25: warning: variable 'id_priv' set but not used [-Wunused-but-set-variable]
Hence remove this variable.
--- src/cma.c | 2 -- 1 file changed, 2 deletions(-)
src/cma.c +0 -2
@@ -1175,11 +1175,9 @@ err:int rdma_create_srq (struct rdma_cm_id *id,struct ibv_pd *pd,struct ibv_srq_init_attr *attr) { -struct cma_id_private *id_priv;struct ibv_srq *srq;int ret; - id_priv = container_of(id, struct cma_id_private, id);if (!pd) pd = id->pd;
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/4 rsocket: Remove the unused variable 'ret'
In reply to a message not in the archiveThe variable 'ret' is assigned a value but that value is never used. This triggers the following compiler warning:
src/rsocket.c:3720:9: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
Hence remove this variable.
--- src/rsocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/rsocket.c +3 -3
@@ -3717,11 +3717,11 @@ static void rs_svc_process_sock(void)static uint8_t rs_svc_sgid_index (struct ds_dest *dest,union ibv_gid *sgid) {union ibv_gid gid; -int i, ret; +int i;for (i =0 ; i <16 ; i++) { - ret =ibv_query_gid (dest->qp->cm_id->verbs, dest->qp->cm_id->port_num, - i, &gid); +ibv_query_gid (dest->qp->cm_id->verbs, dest->qp->cm_id->port_num, + i, &gid);if (!memcmp (sgid, &gid,sizeof gid))return i; }
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/4 Declare 'server_port' as an unsigned variable
In reply to a message not in the archiveChange the data type of the 'server_port' variable from signed to unsigned such that the cast in the fscanf() call can be removed.
--- src/acm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
src/acm.c +3 -2
@@ -35,6 +35,7 @@#endif /* HAVE_CONFIG_H */ #include <stdio.h> +#include <inttypes.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h>
@@ -113,7 +114,7 @@ struct acm_msg {static pthread_mutex_t acm_lock =PTHREAD_MUTEX_INITIALIZER ;static int sock =-1 ; -static short server_port; +static uint16_t server_port;struct ib_connect_hdr {uint8_t cma_version;
@@ -132,7 +133,7 @@ static int ucma_set_server_port(void)FILE *f;if ((f =fopen ("/var/run/ibacm.port" ,"r" STREAM_CLOEXEC ))) { -fscanf (f,"%hu" , (unsigned short *) &server_port); +fscanf (f,"%" SCNu16, &server_port);fclose (f); }return server_port;
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 4/4] Declare 'server_port' as an unsigned variable
thanks - applied all 4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html