Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe953904 authored by Michał Mirosław's avatar Michał Mirosław Committed by Mark Brown
Browse files

regulator: tps65910: check TPS65910_NUM_REGS at build time



Check TPS65910_NUM_REGS at build time instead of silently registering
not all regulators at runtime.

Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2ea659a9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)

	switch (tps65910_chip_id(tps65910)) {
	case TPS65910:
		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
		pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
		pmic->ext_sleep_control = tps65910_ext_sleep_control;
@@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
					DCDCCTRL_DCDCCKSYNC_MASK);
		break;
	case TPS65911:
		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
		pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
		pmic->ext_sleep_control = tps65911_ext_sleep_control;
@@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
	if (!pmic->rdev)
		return -ENOMEM;

	for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
			i++, info++) {
	for (i = 0; i < pmic->num_regulators; i++, info++) {
		/* Register the regulators */
		pmic->info[i] = info;