From 392f036ad4f897df1e986788a45b1301030bbac9 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 7 Oct 2025 17:41:05 +0100 Subject: [PATCH] NVIDIA: SAUCE: soc/tegra: pmc: Initialise mutex In Linux v6.15, commit 337369f8ce9e ("locking/mutex: Add MUTEX_WARN_ON() into fast path") added a WARN to detect incorrectly initialised mutexes and since this commit the following warning has been observed for Tegra264 platforms ... DEBUG_LOCKS_WARN_ON(lock->magic != lock) WARNING: CPU: 1 PID: 168 at kernel/locking/mutex.c:155 mutex_lock+0xd8/0xe8 ... Call trace: mutex_lock+0xd8/0xe8 (P) tegra_io_pad_pinconf_set+0xf4/0x308 pinconf_apply_setting+0xa8/0x140 pinctrl_commit_state+0x104/0x2b0 pinctrl_select_state+0x24/0x50 tegra_sdhci_set_padctrl+0x98/0x258 sdhci_tegra_start_signal_voltage_switch+0x84/0x170 mmc_set_initial_signal_voltage+0x40/0x1a0 mmc_power_up.part.0+0x60/0x190 mmc_start_host+0xb8/0xd0 mmc_add_host+0x8c/0x110 __sdhci_add_host+0x23c/0x390 sdhci_add_host+0x4c/0x68 sdhci_tegra_probe+0x800/0xba8 platform_probe+0x70/0x118 really_probe+0xd4/0x3e0 __driver_probe_device+0x90/0x1a8 driver_probe_device+0x44/0x170 __device_attach_driver+0xf0/0x1e8 bus_for_each_drv+0x90/0x110 __device_attach_async_helper+0xc4/0x128 async_run_entry_fn+0x40/0x190 process_one_work+0x180/0x448 worker_thread+0x274/0x390 kthread+0x158/0x260 ret_from_fork+0x10/0x20 Reviewing the Tegra264 PMC driver code, the mutex for the powergates is never initialised and so fix this by ensuring the mutex is initialised correctly during probe. Bug 4470933 Bug 5344712 Change-Id: Icf4b1a03af342334918ed707faaf2565d215e94e Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/canonical/linux-noble/+/3465120 (cherry picked from commit 1a9032659680530998cc353699c0ca64b176b4d2) Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/canonical/linux-noble/+/3468705 Reviewed-by: Brad Griffis GVS: buildbot_gerritrpt --- drivers/soc/tegra/tegra264-pmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/tegra/tegra264-pmc.c b/drivers/soc/tegra/tegra264-pmc.c index c6df49d73ad7..c421dae8e181 100644 --- a/drivers/soc/tegra/tegra264-pmc.c +++ b/drivers/soc/tegra/tegra264-pmc.c @@ -117,6 +117,7 @@ static int tegra_pmc_probe(struct platform_device *pdev) pmc->soc = of_device_get_match_data(&pdev->dev); pmc->dev = &pdev->dev; + mutex_init(&pmc->powergates_lock); /* take over the memory region from the early initialization */ pmc->base = devm_platform_ioremap_resource(pdev, 0);