diff mbox

[25/28] Avoid gcc 5.4 warning -Wtype-limits

Message ID 1473109698-31408-26-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Superseded
Headers show

Commit Message

Jason Gunthorpe Sept. 5, 2016, 9:08 p.m. UTC
Eg: comparison of unsigned expression < 0 is always false

These are all harmless cases where some simple adjustments will
supress the warning.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 libcxgb3/src/iwch.c    | 2 +-
 libcxgb4/src/dev.c     | 4 ++--
 libibverbs/src/neigh.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Steve Wise Sept. 7, 2016, 6:05 p.m. UTC | #1
> Eg: comparison of unsigned expression < 0 is always false
> 
> These are all harmless cases where some simple adjustments will
> supress the warning.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> ---
>  libcxgb3/src/iwch.c    | 2 +-
>  libcxgb4/src/dev.c     | 4 ++--

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

libcxgb* patches applied.

Thanks,

Steve. 


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/libcxgb3/src/iwch.c b/libcxgb3/src/iwch.c
index 32447e427146..dd0d3711f2e2 100644
--- a/libcxgb3/src/iwch.c
+++ b/libcxgb3/src/iwch.c
@@ -225,7 +225,7 @@  found:
 
 	DBGLOG("libcxgb3");
 
-	if (fw_min < FW_MIN) {
+	if ((signed int)fw_min < FW_MIN) {
 		PDBG("libcxgb3: non-fatal firmware version mismatch.  "
 			"Firmware minor number is %u and libcxgb3 needs %u.\n",
 			fw_min, FW_MIN);
diff --git a/libcxgb4/src/dev.c b/libcxgb4/src/dev.c
index cd3217af77b2..ebcc72ecc991 100644
--- a/libcxgb4/src/dev.c
+++ b/libcxgb4/src/dev.c
@@ -435,7 +435,7 @@  found:
 	cp = strtok(NULL, ".");
 	sscanf(cp, "%i", &fw_min);
 
-	if (fw_maj < FW_MAJ) {
+	if ((signed int)fw_maj < FW_MAJ) {
 		fprintf(stderr, "libcxgb4: Fatal firmware version mismatch.  "
 			"Firmware major number is %u and libcxgb4 needs %u.\n",
 			fw_maj, FW_MAJ);
@@ -445,7 +445,7 @@  found:
 
 	DBGLOG("libcxgb4");
 
-	if (fw_min < FW_MIN) {
+	if ((signed int)fw_min < FW_MIN) {
 		PDBG("libcxgb4: non-fatal firmware version mismatch.  "
 			"Firmware minor number is %u and libcxgb4 needs %u.\n",
 			fw_min, FW_MIN);
diff --git a/libibverbs/src/neigh.c b/libibverbs/src/neigh.c
index dc8c2bc99ae3..6b6e58cd52f8 100644
--- a/libibverbs/src/neigh.c
+++ b/libibverbs/src/neigh.c
@@ -727,7 +727,7 @@  uint16_t neigh_get_vlan_id_from_dev(struct get_neigh_handler *neigh_handler)
 
 void neigh_set_vlan_id(struct get_neigh_handler *neigh_handler, uint16_t vid)
 {
-	if (vid >= 0 && vid <= 0xfff)
+	if (vid <= 0xfff)
 		neigh_handler->vid = vid;
 }