mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 13:23:02 -04:00
power: supply: bq256xx: drop always-true inner condition
In bq256xx_array_parse() the inner "if (val < array[i])" repeats the second half of the enclosing "if (val > array[i - 1] && val < array[i])", so it is always true and the "else return i" arm is dead code. The function performs a round-down table lookup, so returning i - 1 for a value that falls strictly between two entries is the intended result. Collapse the redundant branch into a single "return i - 1;"; no functional change. Signed-off-by: Anas Khan <anxkhn28@gmail.com> Link: https://patch.msgid.link/20260702194547.65209-1-anxkhn28@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
committed by
Sebastian Reichel
parent
741a9b0977
commit
39a4e68035
@@ -347,12 +347,8 @@ static int bq256xx_array_parse(int array_size, int val, const int array[])
|
||||
if (val == array[i])
|
||||
return i;
|
||||
|
||||
if (val > array[i - 1] && val < array[i]) {
|
||||
if (val < array[i])
|
||||
return i - 1;
|
||||
else
|
||||
return i;
|
||||
}
|
||||
if (val > array[i - 1] && val < array[i])
|
||||
return i - 1;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user