[PATCH 1/2] regulator: s2mps11: drop redundant sanity checks in s2mpg10_of_parse_cb()

From: André Draszik

Date: Mon Feb 09 2026 - 10:09:41 EST


The sanity checks being removed in this commit are useless as earlier
code checks for out-of-bounds conditions already. They also are
incorrect (as they're off-by-one).

Simply remove this incorrect code.

No functional change.

Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/aYmsu8qREppwBESH@stanley.mountain/
Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
---
drivers/regulator/s2mps11.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 2d5510acd0780ab6f9296c48ddcde5efe15ff488..2d67c5c16f487506a2e9e4b119f33faa846269f7 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -478,8 +478,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
return -EINVAL;
}

- if (ext_control > ARRAY_SIZE(ext_control_s2mpg10))
- return -EINVAL;
ext_control = ext_control_s2mpg10[ext_control];
break;

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

- if (ext_control > ARRAY_SIZE(ext_control_s2mpg11))
- return -EINVAL;
ext_control = ext_control_s2mpg11[ext_control];
break;


--
2.53.0.rc2.204.g2597b5adb4-goog