Skip to content
Unverified Commit 1aa1b918 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown
Browse files

regulator: max8997: clean up a condition in max8997_list_voltage()



The current code generates a static cehcker warnings because "rid < 0"
is always false:

    drivers/regulator/max8997-regulator.c:169 max8997_list_voltage()
    warn: condition is always false

The problem is that because of type promotion, if "rid" is negative the
comparison against ARRAY_SIZE() is type promoted to size_t and it's
treated as a very high positive value.  I've changed the order of the
checks so now everyone is happy.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent ed1ae2dd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment