Le 22/03/2018 à 22:05, Mathieu Malaterre a écrit :
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



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

Signed-off-by: Mathieu Malaterre <ma...@debian.org>
---
  drivers/misc/cxl/guest.c | 5 -----
  1 file changed, 5 deletions(-)

diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index f58b4b6c79f2..48103fcff0b5 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -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;
  }


Reply via email to