Re: [BUG] NULL pointer in dev_pm_opp_put_regulators

From: Viresh Kumar
Date: Wed Jan 20 2021 - 03:18:21 EST


On 20-01-21, 08:59, Krzysztof Kozlowski wrote:
> Hi,
>
> Today's next fails to boot on Exynos5422 Odroid HC1 board:
>
> [ 6.409023] Unable to handle kernel NULL pointer dereference at virtual address 00000004
> [ 6.417199] pgd = (ptrval)
> [ 6.419748] [00000004] *pgd=00000000
> [ 6.423499] Internal error: Oops: 805 [#1] PREEMPT SMP ARM
> [ 6.428724] Modules linked in:
> [ 6.431752] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.11.0-rc4-next-20210120 #2
> [ 6.439209] Hardware name: Samsung Exynos (Flattened Device Tree)
> [ 6.445273] PC is at dev_pm_opp_put_regulators+0xb4/0x114
> ...
> [ 6.680370] [<c086f51c>] (dev_pm_opp_put_regulators) from [<c08d5d48>] (exynos_bus_probe+0x45c/0x620)
> [ 6.689556] [<c08d5d48>] (exynos_bus_probe) from [<c06b49a8>] (platform_probe+0x80/0xc0)
> [ 6.697614] [<c06b49a8>] (platform_probe) from [<c06b1ab4>] (really_probe+0x1d4/0x500)
> [ 6.705499] [<c06b1ab4>] (really_probe) from [<c06b1e58>] (driver_probe_device+0x78/0x1dc)
> [ 6.713731] [<c06b1e58>] (driver_probe_device) from [<c06b236c>] (device_driver_attach+0x58/0x60)
> [ 6.722571] [<c06b236c>] (device_driver_attach) from [<c06b2470>] (__driver_attach+0xfc/0x160)
> [ 6.731149] [<c06b2470>] (__driver_attach) from [<c06af85c>] (bus_for_each_dev+0x68/0xb4)
> [ 6.739294] [<c06af85c>] (bus_for_each_dev) from [<c06b0b5c>] (bus_add_driver+0x158/0x214)
> [ 6.747526] [<c06b0b5c>] (bus_add_driver) from [<c06b3314>] (driver_register+0x78/0x110)
> [ 6.755585] [<c06b3314>] (driver_register) from [<c0102464>] (do_one_initcall+0x8c/0x430)
> [ 6.763731] [<c0102464>] (do_one_initcall) from [<c11010e4>] (kernel_init_freeable+0x190/0x1e0)
> [ 6.772397] [<c11010e4>] (kernel_init_freeable) from [<c0b4fc50>] (kernel_init+0x8/0x120)
> [ 6.780542] [<c0b4fc50>] (kernel_init) from [<c010011c>] (ret_from_fork+0x14/0x38)
>
> https://krzk.eu/#/builders/21/builds/2862/steps/15/logs/serial0
>
> I did not do a bisect but the last commit touching these parts was:
>
> commit 302c014726dbd9fcde852985528c139d2214a1f2
> Author: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> Date: Tue Jan 19 11:58:58 2021 +0530
> opp: Prepare for ->set_opp() helper to work without regulators
>
> Maybe you have some idea of cause?

t a/drivers/opp/core.c b/drivers/opp/core.c
index 1ed673334565..7c0e0e76a57e 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2038,7 +2038,7 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
regulator_put(opp_table->regulators[i]);

mutex_lock(&opp_table->lock);
- if (opp_table->sod_supplies) {
+ if (opp_table->set_opp_data) {
opp_table->set_opp_data->old_opp.supplies = NULL;
opp_table->set_opp_data->new_opp.supplies = NULL;
}

This shall fix it, sorry about that. I have pushed my branch again. Thanks.

--
viresh