Unverified Commit 5a1256ac authored by André Draszik's avatar André Draszik Committed by Mark Brown
Browse files

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: default avatarDan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aYmsu8qREppwBESH@stanley.mountain/


Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: default avatarAndré Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260210-s2mpg1x-regulators-fixes-v2-1-ab3d3457f1ae@linaro.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e243cdd8
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -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;