Re: [PATCH net] net: stmmac: platform: fix the incorrect parameter
From: Jacob Keller
Date: Thu Sep 21 2023 - 16:51:57 EST
On 9/20/2023 11:24 PM, Clark Wang wrote:
> The second parameter of stmmac_pltfr_init() needs the pointer of
> "struct plat_stmmacenet_data". So, correct the parameter typo when calling the
> function.
>
> Otherwise, it may cause this alignment exception when doing suspend/resume.
> [ 49.067201] CPU1 is up
> [ 49.135258] Internal error: SP/PC alignment exception: 000000008a000000 [#1] PREEMPT SMP
> [ 49.143346] Modules linked in: soc_imx9 crct10dif_ce polyval_ce nvmem_imx_ocotp_fsb_s400 polyval_generic layerscape_edac_mod snd_soc_fsl_asoc_card snd_soc_imx_audmux snd_soc_imx_card snd_soc_wm8962 el_enclave snd_soc_fsl_micfil rtc_pcf2127 rtc_pcf2131 flexcan can_dev snd_soc_fsl_xcvr snd_soc_fsl_sai imx8_media_dev(C) snd_soc_fsl_utils fuse
> [ 49.173393] CPU: 0 PID: 565 Comm: sh Tainted: G C 6.5.0-rc4-next-20230804-05047-g5781a6249dae #677
> [ 49.183721] Hardware name: NXP i.MX93 11X11 EVK board (DT)
> [ 49.189190] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [ 49.196140] pc : 0x80800052
> [ 49.198931] lr : stmmac_pltfr_resume+0x34/0x50
> [ 49.203368] sp : ffff800082f8bab0
> [ 49.206670] x29: ffff800082f8bab0 x28: ffff0000047d0ec0 x27: ffff80008186c170
> [ 49.213794] x26: 0000000b5e4ff1ba x25: ffff800081e5fa74 x24: 0000000000000010
> [ 49.220918] x23: ffff800081fe0000 x22: 0000000000000000 x21: 0000000000000000
> [ 49.228042] x20: ffff0000001b4010 x19: ffff0000001b4010 x18: 0000000000000006
> [ 49.235166] x17: ffff7ffffe007000 x16: ffff800080000000 x15: 0000000000000000
> [ 49.242290] x14: 00000000000000fc x13: 0000000000000000 x12: 0000000000000000
> [ 49.249414] x11: 0000000000000001 x10: 0000000000000a60 x9 : ffff800082f8b8c0
> [ 49.256538] x8 : 0000000000000008 x7 : 0000000000000001 x6 : 000000005f54a200
> [ 49.263662] x5 : 0000000001000000 x4 : ffff800081b93680 x3 : ffff800081519be0
> [ 49.270786] x2 : 0000000080800052 x1 : 0000000000000000 x0 : ffff0000001b4000
> [ 49.277911] Call trace:
> [ 49.280346] 0x80800052
> [ 49.282781] platform_pm_resume+0x2c/0x68
> [ 49.286785] dpm_run_callback.constprop.0+0x74/0x134
> [ 49.291742] device_resume+0x88/0x194
> [ 49.295391] dpm_resume+0x10c/0x230
> [ 49.298866] dpm_resume_end+0x18/0x30
> [ 49.302515] suspend_devices_and_enter+0x2b8/0x624
> [ 49.307299] pm_suspend+0x1fc/0x348
> [ 49.310774] state_store+0x80/0x104
> [ 49.314258] kobj_attr_store+0x18/0x2c
> [ 49.318002] sysfs_kf_write+0x44/0x54
> [ 49.321659] kernfs_fop_write_iter+0x120/0x1ec
> [ 49.326088] vfs_write+0x1bc/0x300
> [ 49.329485] ksys_write+0x70/0x104
> [ 49.332874] __arm64_sys_write+0x1c/0x28
> [ 49.336783] invoke_syscall+0x48/0x114
> [ 49.340527] el0_svc_common.constprop.0+0xc4/0xe4
> [ 49.345224] do_el0_svc+0x38/0x98
> [ 49.348526] el0_svc+0x2c/0x84
> [ 49.351568] el0t_64_sync_handler+0x100/0x12c
> [ 49.355910] el0t_64_sync+0x190/0x194
> [ 49.359567] Code: ???????? ???????? ???????? ???????? (????????)
> [ 49.365644] ---[ end trace 0000000000000000 ]---
>
> Fixes: 97117eb51ec8 ("net: stmmac: platform: provide stmmac_pltfr_init()")
> Signed-off-by: Clark Wang <xiaoning.wang@xxxxxxx>
> ---> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 0d9b2138b60a..3c6fd9027934 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -900,7 +900,7 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev)
> struct platform_device *pdev = to_platform_device(dev);
> int ret;
>
> - ret = stmmac_pltfr_init(pdev, priv->plat->bsp_priv);
> + ret = stmmac_pltfr_init(pdev, priv->plat);
> if (ret)
And this compiled because priv->plat->bsp_priv is a void pointer.
Makes sense.
Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
> return ret;
>