]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
regulator: tps6507x: Fix boot regression due to testing wrong init_data pointer
authorAxel Lin <axel.lin@ingics.com>
Thu, 16 May 2019 12:48:08 +0000 (20:48 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 16 May 2019 16:11:47 +0000 (17:11 +0100)
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>
drivers/regulator/tps6507x-regulator.c

index a1b7fab91dd4d836a2c13037c249f0d8b7c160c1..d2a8f69b2665f9c4123440678deaa0d31d2c6f0c 100644 (file)
@@ -403,12 +403,12 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
        /* common for all regulators */
        tps->mfd = tps6507x_dev;
 
-       for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) {
+       for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++) {
                /* Register the regulators */
                tps->info[i] = info;
-               if (init_data && init_data->driver_data) {
+               if (init_data && init_data[i].driver_data) {
                        struct tps6507x_reg_platform_data *data =
-                                       init_data->driver_data;
+                                       init_data[i].driver_data;
                        info->defdcdc_default = data->defdcdc_default;
                }