Skip to content

Commit

Permalink
regulator: tps65217: invalid if check
Browse files Browse the repository at this point in the history
This permits the setting of bogus values because the invalidity check is
itself invalid.

Reported-by: dcb314@hotmail.com
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Alan Cox authored and Mark Brown committed Jul 2, 2012
1 parent 1e12dfc commit 1a5d39d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/regulator/tps65217-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int tps65217_vsel_to_uv1(unsigned int vsel)

static int tps65217_uv_to_vsel1(int uV, unsigned int *vsel)
{
if ((uV < 0) && (uV > 3300000))
if (uV < 0 || uV > 3300000)
return -EINVAL;

if (uV <= 1500000)
Expand Down Expand Up @@ -112,7 +112,7 @@ static int tps65217_vsel_to_uv2(unsigned int vsel)

static int tps65217_uv_to_vsel2(int uV, unsigned int *vsel)
{
if ((uV < 0) && (uV > 3300000))
if (uV < 0 || uV > 3300000)
return -EINVAL;

if (uV <= 1900000)
Expand Down

0 comments on commit 1a5d39d

Please sign in to comment.