Skip to content

Commit

Permalink
regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Lee Jones authored and Mark Brown committed Jun 26, 2020
1 parent 44455a6 commit 02d8886
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/regulator/tps65218-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int tps65218_pmic_set_suspend_enable(struct regulator_dev *dev)
struct tps65218 *tps = rdev_get_drvdata(dev);
unsigned int rid = rdev_get_id(dev);

if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
if (rid > TPS65218_LDO_1)
return -EINVAL;

return tps65218_clear_bits(tps, dev->desc->bypass_reg,
Expand All @@ -141,7 +141,7 @@ static int tps65218_pmic_set_suspend_disable(struct regulator_dev *dev)
struct tps65218 *tps = rdev_get_drvdata(dev);
unsigned int rid = rdev_get_id(dev);

if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
if (rid > TPS65218_LDO_1)
return -EINVAL;

/*
Expand Down

0 comments on commit 02d8886

Please sign in to comment.