Commit 1a5d39d0 authored by Alan Cox's avatar Alan Cox Committed by Mark Brown

regulator: tps65217: invalid if check

This permits the setting of bogus values because the invalidity check is
itself invalid.

Reported-by: dcb314@hotmail.com
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 1e12dfc9
...@@ -78,7 +78,7 @@ static int tps65217_vsel_to_uv1(unsigned int vsel) ...@@ -78,7 +78,7 @@ static int tps65217_vsel_to_uv1(unsigned int vsel)
static int tps65217_uv_to_vsel1(int uV, 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; return -EINVAL;
if (uV <= 1500000) if (uV <= 1500000)
...@@ -112,7 +112,7 @@ static int tps65217_vsel_to_uv2(unsigned int vsel) ...@@ -112,7 +112,7 @@ static int tps65217_vsel_to_uv2(unsigned int vsel)
static int tps65217_uv_to_vsel2(int uV, 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; return -EINVAL;
if (uV <= 1900000) if (uV <= 1900000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment