Message ID | 20200402063721.37868-1-yanaijie@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | sifive_l2_cache: remove unnecessary comparison | expand |
diff --git a/drivers/soc/sifive/sifive_l2_cache.c b/drivers/soc/sifive/sifive_l2_cache.c index a5069394cd61..17181879fcbc 100644 --- a/drivers/soc/sifive/sifive_l2_cache.c +++ b/drivers/soc/sifive/sifive_l2_cache.c @@ -48,7 +48,7 @@ static ssize_t l2_write(struct file *file, const char __user *data, if (kstrtouint_from_user(data, count, 0, &val)) return -EINVAL; - if ((val >= 0 && val < 0xFF) || (val >= 0x10000 && val < 0x100FF)) + if (val < 0xFF || (val >= 0x10000 && val < 0x100FF)) writel(val, l2_base + SIFIVE_L2_ECCINJECTERR); else return -EINVAL;
The variable val is unsigend and val >= 0 is always true. Fix the following gcc warning: drivers/soc/sifive/sifive_l2_cache.c:51:11: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] if ((val >= 0 && val < 0xFF) || (val >= 0x10000 && val < 0x100FF)) ^~ Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> --- drivers/soc/sifive/sifive_l2_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)