Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' check

'rid' is declared as unsigned int, so there is little point checking for <0.

Removing these checks fixes the following W=1 warnings:

drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_enable’:
drivers/regulator/tps65218-regulator.c:131:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
131 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
| ^
drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_disable’:
drivers/regulator/tps65218-regulator.c:144:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
144 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
| ^

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: linux-omap@vger.kernel.org
Link: https://lore.kernel.org/r/20200626065738.93412-8-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Lee Jones and committed by
Mark Brown
02d88863 44455a6d

+2 -2
+2 -2
drivers/regulator/tps65218-regulator.c
··· 128 128 struct tps65218 *tps = rdev_get_drvdata(dev); 129 129 unsigned int rid = rdev_get_id(dev); 130 130 131 - if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1) 131 + if (rid > TPS65218_LDO_1) 132 132 return -EINVAL; 133 133 134 134 return tps65218_clear_bits(tps, dev->desc->bypass_reg, ··· 141 141 struct tps65218 *tps = rdev_get_drvdata(dev); 142 142 unsigned int rid = rdev_get_id(dev); 143 143 144 - if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1) 144 + if (rid > TPS65218_LDO_1) 145 145 return -EINVAL; 146 146 147 147 /*