Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

regulator: s2mps11: drop redundant sanity checks in s2mpg10_of_parse_cb()

The sanity checks being removed in this commit are useless as earlier
code already checks for all conditions, including all error cases like
out-of-bounds conditions. In other words, the code being removed here
has no effect, as any potential error it could catch will already have
been caught by earlier code.

The checks removed here are also incomplete (as they're off-by-one) -
they should have been checking >= ARRAY_SIZE() to be complete.

Simply remove this redundant and incorrect code.

No functional change.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aYmsu8qREppwBESH@stanley.mountain/
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260210-s2mpg1x-regulators-fixes-v2-1-ab3d3457f1ae@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

André Draszik and committed by
Mark Brown
5a1256ac e243cdd8

-4
-4
drivers/regulator/s2mps11.c
··· 478 478 return -EINVAL; 479 479 } 480 480 481 - if (ext_control > ARRAY_SIZE(ext_control_s2mpg10)) 482 - return -EINVAL; 483 481 ext_control = ext_control_s2mpg10[ext_control]; 484 482 break; 485 483 ··· 501 503 return -EINVAL; 502 504 } 503 505 504 - if (ext_control > ARRAY_SIZE(ext_control_s2mpg11)) 505 - return -EINVAL; 506 506 ext_control = ext_control_s2mpg11[ext_control]; 507 507 break; 508 508