From 2f27a48ee399ac21c3a03ccd971cd4c6c820d2a7 Mon Sep 17 00:00:00 2001 From: Ziyuan Xu Date: Thu, 28 Apr 2022 17:32:19 +0800 Subject: [PATCH] mmc: dw_mmc: fixes crash when CONFIG_ROCKCHIP_THUNDER_BOOT=y [ 100.584484] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 100.584500] pgd = 466047cd [ 100.584509] [00000000] *pgd=00000000 [ 100.584526] Internal error: Oops - BUG: 17 [#1] THUMB2 [ 100.584534] Modules linked in: dw_mmc_rockchip(+) rknpu snd_soc_rv1106 rockit(O) mpp_vcodec(O) rga3 [ 100.584586] CPU: 0 PID: 9 Comm: kworker/u2:1 Tainted: G O 5.10.66 #9 [ 100.584593] Hardware name: Generic DT based system [ 100.584618] Workqueue: events_unbound async_run_entry_fn [ 100.584638] PC is at dw_mci_probe+0x10a/0x7dc [ 100.584655] LR is at clk_core_enable_lock+0x19/0x1c [ 100.584667] pc : [] lr : [] psr: 60000033 [ 100.584676] sp : b00a1e88 ip : b1caf580 fp : af8c29f4 [ 100.584686] r10: 00000000 r9 : af8c2c04 r8 : af8c29f4 [ 100.584696] r7 : b00cc4e4 r6 : 00000001 r5 : b1caf450 r4 : b1c8c010 [ 100.584706] r3 : 00000000 r2 : b05b095c r1 : 00000000 r0 : 00000000 [ 100.584720] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user [ 100.584731] Control: 50c53c7d Table: 01c88059 DAC: 00000055 [ 100.584743] Process kworker/u2:1 (pid: 9, stack limit = 0xc7a2c6f9) [ 100.584753] Stack: (0xb00a1e88 to 0xb00a2000) [ 100.584769] 1e80: 00000001 00000001 ff9a0000 b02cce69 b1caf410 00000000 [ 100.584787] 1ea0: b1c8c010 b00cc400 b00cc410 b00cc410 b00cc400 00000001 b00cc4e4 af8c29f4 [ 100.584805] 1ec0: af8c2c04 0000000a 00000000 af8c2469 00000000 b00cc410 af8c2c04 b05b1e04 [ 100.584822] 1ee0: 00000000 b031b3e3 b00cc410 00000000 b05b1e08 b031a775 00000000 b00cc410 [ 100.584840] 1f00: af8c2c04 b1caf2c0 b0008000 00000000 00000000 b1caf2d4 00000000 b031a959 [ 100.584858] 1f20: b00bed00 b00cc410 b05a1018 b031a989 b1caf2d0 b0223ad5 b002f8a0 b1caf2d0 [ 100.584877] 1f40: b0007000 b021f917 b002f8a0 b1caf2d0 b002f8a0 b002f8b4 b0007000 b057ed20 [ 100.584896] 1f60: b05a191c b0007014 b0007040 b021fbc3 b009d300 b0094920 ffffe000 b005bed0 [ 100.584914] 1f80: b021fae1 b002f8a0 b009d320 b0222553 b0094920 b02224b1 00000000 00000000 [ 100.584931] 1fa0: 00000000 00000000 00000000 b02082e9 00000000 00000000 00000000 00000000 [ 100.584946] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 100.584962] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ 100.585012] [] (dw_mci_probe) from [] (dw_mci_rockchip_probe+0x79/0xbc [dw_mmc_rockchip]) [ 100.585049] [] (dw_mci_rockchip_probe [dw_mmc_rockchip]) from [] (platform_drv_probe+0x2d/0x5a) [ 100.585074] [] (platform_drv_probe) from [] (really_probe+0x16f/0x23e) [ 100.585096] [] (really_probe) from [] (driver_probe_device+0x5d/0x6c) [ 100.585118] [] (driver_probe_device) from [] (__driver_attach_async_helper+0x21/0x32) [ 100.585139] [] (__driver_attach_async_helper) from [] (async_run_entry_fn+0x25/0xa0) [ 100.585165] [] (async_run_entry_fn) from [] (process_one_work+0xd5/0x136) [ 100.585191] [] (process_one_work) from [] (worker_thread+0xe3/0x190) [ 100.585213] [] (worker_thread) from [] (kthread+0xa3/0xac) [ 100.585237] [] (kthread) from [] (ret_from_fork+0x11/0x28) [ 100.585248] Exception stack(0xb00a1fb0 to 0xb00a1ff8) Signed-off-by: Ziyuan Xu Change-Id: Ia0e2d83c53a757b1cf3703408a2803052ff78049 --- drivers/mmc/host/dw_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 513b0d25df90..02b1bedbefdd 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -3317,8 +3317,8 @@ int dw_mci_probe(struct dw_mci *host) } #ifdef CONFIG_ROCKCHIP_THUNDER_BOOT - if (host->slot->mmc->caps2 & MMC_CAP2_NO_SD && - host->slot->mmc->caps2 & MMC_CAP2_NO_SDIO) { + if (device_property_read_bool(host->dev, "no-sd") && + device_property_read_bool(host->dev, "no-sdio")) { if (readl_poll_timeout(host->regs + SDMMC_STATUS, fifo_size, !(fifo_size & (BIT(10) | GENMASK(7, 4))),