Avoid that building with W=1 triggers the following compiler warning: drivers/md/bcache/util.c: In function 'bch_strtoull_h': drivers/md/bcache/util.c:70:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] (i < 0 && -ANYSINT_MAX(type) / 1024 > i)) \ ^ The only functional change in this patch is that (type) ~0 is changed into ~(type)0. That makes a difference for unsigned types for which sizeof(type) > sizeof(int). I think this change is a bug fix. Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx> --- drivers/md/bcache/util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index 74febd5230df..755523474649 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -25,6 +25,7 @@ int bch_ ## name ## _h(const char *cp, type *res) \ int u = 0; \ char *e; \ type i = simple_ ## name(cp, &e, 10); \ + const type zero = 0; \ \ switch (tolower(*e)) { \ default: \ @@ -63,11 +64,10 @@ int bch_ ## name ## _h(const char *cp, type *res) \ return -EINVAL; \ \ while (u--) { \ - if ((type) ~0 > 0 && \ - (type) ~0 / 1024 <= i) \ + if (~zero > 0 && ~zero / 1024 <= i) \ return -EINVAL; \ - if ((i > 0 && ANYSINT_MAX(type) / 1024 < i) || \ - (i < 0 && -ANYSINT_MAX(type) / 1024 > i)) \ + if ((i > zero && ANYSINT_MAX(type) / 1024 < i) ||\ + (i < zero && -ANYSINT_MAX(type) / 1024 > i))\ return -EINVAL; \ i *= 1024; \ } \ -- 2.16.2