Skip to contentSkip to conversation

cxl: remove a dead branch

PATCH Applied Mathieu Malaterre 4 participants 5 messages Mar 22, 2018 – Aug 14, 2018 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxl: remove a dead branch

In commit 14baf4d9c739 ("cxl: Add guest-specific code") the following code was added:

	if (afu->crs_len < 0) {
		dev_err(&afu->dev, "Unexpected configuration record size value\n");
		return -EINVAL;
	}

However the variable crs_len is of type u64 and cannot be compared < 0. Remove the dead code section. Fix the following warning treated as error with W=1:

../drivers/misc/cxl/guest.c:919:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

---
 drivers/misc/cxl/guest.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/misc/cxl/guest.c +0 -5
index f58b4b6c79f2..48103fcff0b5 100644
@@ -916,11 +916,6 @@ static int afu_properties_look_ok(struct cxl_afu *afu)
 		return -EINVAL;
 	}
 
-	if (afu->crs_len < 0) {
-		dev_err(&afu->dev, "Unexpected configuration record size value\n");
-		return -EINVAL;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.11.0
#1 lore raw

Le 22/03/2018 à 22:05, Mathieu Malaterre a écrit :

Quoted 11 lines

In commit 14baf4d9c739 ("cxl: Add guest-specific code") the following code was added:

	if (afu->crs_len < 0) {
		dev_err(&afu->dev, "Unexpected configuration record size value\n");
		return -EINVAL;
	}

However the variable crs_len is of type u64 and cannot be compared < 0. Remove the dead code section. Fix the following warning treated as error with W=1:

Thanks for reporting it. The test, as is, is indeed useless. However, instead of just dropping it, we are discussing on improving it.

Fred

Quoted 23 lines

../drivers/misc/cxl/guest.c:919:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

---
  drivers/misc/cxl/guest.c | 5 -----
  1 file changed, 5 deletions(-)
drivers/misc/cxl/guest.c +0 -5
index f58b4b6c79f2..48103fcff0b5 100644
@@ -916,11 +916,6 @@ static int afu_properties_look_ok(struct cxl_afu *afu)
  		return -EINVAL;
  	}
 
-	if (afu->crs_len < 0) {
-		dev_err(&afu->dev, "Unexpected configuration record size value\n");
-		return -EINVAL;
-	}
-
  	return 0;
  }
 
#2 lore raw
In reply to Mathieu Malaterre
Quoted 8 lines · Mathieu Malaterre

In commit 14baf4d9c739 ("cxl: Add guest-specific code") the following code was added:

	if (afu->crs_len < 0) {
		dev_err(&afu->dev, "Unexpected configuration record size value\n");
		return -EINVAL;
	}
Quoted 7 lines

However the variable crs_len is of type u64 and cannot be compared < 0. Remove the dead code section. Fix the following warning treated as error with W=1:

../drivers/misc/cxl/guest.c:919:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e4ecafb14fd9cd77d8f4320af1922e

cheers

#3 lore raw

Frederic,

Could you double check with Michael what is now best to do.

Thanks

Quoted 23 lines · Michael Ellerman
Quoted 8 lines · Mathieu Malaterre

In commit 14baf4d9c739 ("cxl: Add guest-specific code") the following code was added:

      if (afu->crs_len < 0) {
              dev_err(&afu->dev, "Unexpected configuration record size value\n");
              return -EINVAL;
      }
Quoted 7 lines

However the variable crs_len is of type u64 and cannot be compared < 0. Remove the dead code section. Fix the following warning treated as error with W=1:

../drivers/misc/cxl/guest.c:919:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e4ecafb14fd9cd77d8f4320af1922e

cheers

#4 lore raw
Quoted 3 lines · Mathieu Malaterre

Frederic,

Could you double check with Michael what is now best to do.

I decided it had been long enough (since March), so I just merged it.

If Fred et. al. want to do something better they can send me another patch on top of it.

cheers

Quoted 25 lines
Quoted 23 lines · Michael Ellerman
Quoted 8 lines · Mathieu Malaterre

In commit 14baf4d9c739 ("cxl: Add guest-specific code") the following code was added:

      if (afu->crs_len < 0) {
              dev_err(&afu->dev, "Unexpected configuration record size value\n");
              return -EINVAL;
      }
Quoted 7 lines

However the variable crs_len is of type u64 and cannot be compared < 0. Remove the dead code section. Fix the following warning treated as error with W=1:

../drivers/misc/cxl/guest.c:919:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e4ecafb14fd9cd77d8f4320af1922e

cheers