Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312610
b: refs/heads/master
c: 9c6a74c
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 4, 2012
1 parent b3d0db6 commit deae337
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fca53d862dcbddaa9db017b70a64392da8c20bce
refs/heads/master: 9c6a74c5e0ca3bfac09cb1e7bf7629cc0f3aa48c
9 changes: 6 additions & 3 deletions trunk/drivers/regulator/ad5398.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ static int ad5398_set_current_limit(struct regulator_dev *rdev, int min_uA, int
unsigned short data;
int ret;

if (min_uA > chip->max_uA || min_uA < chip->min_uA)
return -EINVAL;
if (max_uA > chip->max_uA || max_uA < chip->min_uA)
if (min_uA < chip->min_uA)
min_uA = chip->min_uA;
if (max_uA > chip->max_uA)
max_uA = chip->max_uA;

if (min_uA > chip->max_uA || max_uA < chip->min_uA)
return -EINVAL;

selector = DIV_ROUND_UP((min_uA - chip->min_uA) * chip->current_level,
Expand Down

0 comments on commit deae337

Please sign in to comment.