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

regulator: tps6507x: Fix boot regression due to testing wrong init_data pointer

A NULL init_data once incremented will lead to oops, fix it.

Fixes: f979c08f7624 ("regulator: tps6507x: Convert to regulator core's simplified DT parsing code")
Reported-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Lin and committed by
Mark Brown
7d293f56 49820944

+3 -3
+3 -3
drivers/regulator/tps6507x-regulator.c
··· 403 403 /* common for all regulators */ 404 404 tps->mfd = tps6507x_dev; 405 405 406 - for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) { 406 + for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++) { 407 407 /* Register the regulators */ 408 408 tps->info[i] = info; 409 - if (init_data && init_data->driver_data) { 409 + if (init_data && init_data[i].driver_data) { 410 410 struct tps6507x_reg_platform_data *data = 411 - init_data->driver_data; 411 + init_data[i].driver_data; 412 412 info->defdcdc_default = data->defdcdc_default; 413 413 } 414 414