regulator: tps65217: invalid if check
authorAlan Cox <alan@linux.intel.com>
Mon, 2 Jul 2012 17:54:17 +0000 (18:54 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 2 Jul 2012 17:26:04 +0000 (18:26 +0100)
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>
drivers/regulator/tps65217-regulator.c

index 3a2b839..0a3df5b 100644 (file)
@@ -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)
@@ -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)