Skip to content

Commit 5a1256a

Browse files
andredbroonie
authored andcommitted
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>
1 parent e243cdd commit 5a1256a

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

drivers/regulator/s2mps11.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
478478
return -EINVAL;
479479
}
480480

481-
if (ext_control > ARRAY_SIZE(ext_control_s2mpg10))
482-
return -EINVAL;
483481
ext_control = ext_control_s2mpg10[ext_control];
484482
break;
485483

@@ -503,8 +501,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
503501
return -EINVAL;
504502
}
505503

506-
if (ext_control > ARRAY_SIZE(ext_control_s2mpg11))
507-
return -EINVAL;
508504
ext_control = ext_control_s2mpg11[ext_control];
509505
break;
510506

0 commit comments

Comments
 (0)