Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LF-6212: mxc: vpu_malone: avoid kernel panic in alloc_dma_buffer
The call trace show the kernel panic occurs in memset_io. Seems dma_alloc_coherent() return an error code on fail instead of NULL. So we use the IS_ERR_OR_NULL to check the return value. But it's strangely as the document has described the function dma_alloc_coherent returns a pointer to the allocated region (in the processor's virtual address space) or NULL if the allocation failed. 2022-05-24T04:06:15 [ 745.193344] Unable to handle kernel paging request at virtual address ffffffffffffffe8 2022-05-24T04:06:15 [ 745.201296] Mem abort info: 2022-05-24T04:06:15 [ 745.204101] ESR = 0x86000004 2022-05-24T04:06:15 [ 745.207161] EC = 0x21: IABT (current EL), IL = 32 bits 2022-05-24T04:06:15 [ 745.212503] SET = 0, FnV = 0 2022-05-24T04:06:15 [ 745.215596] EA = 0, S1PTW = 0 2022-05-24T04:06:15 [ 745.218740] FSC = 0x04: level 0 translation fault 2022-05-24T04:06:15 [ 745.224070] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000081b03000 2022-05-24T04:06:15 [ 745.231018] [ffffffffffffffe8] pgd=0000000000000000, p4d=0000000000000000 2022-05-24T04:06:15 [ 745.237851] Internal error: Oops: 86000004 [#1] PREEMPT SMP 2022-05-24T04:06:16 [ 745.287814] Hardware name: Freescale i.MX8QM MEK (DT) 2022-05-24T04:06:16 [ 745.292862] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) 2022-05-24T04:06:16 [ 745.299819] pc : 0xffffffffffffffe8 2022-05-24T04:06:16 [ 745.303303] lr : alloc_dma_buffer+0x5c/0xdc 2022-05-24T04:06:16 [ 745.307499] sp : ffff80001686ba50 2022-05-24T04:06:16 [ 745.310809] x29: ffff80001686ba50 x28: ffff00081e934008 x27: 0000000000000000 2022-05-24T04:06:16 [ 745.317950] x26: ffff00081e934680 x25: ffff00081e934900 x24: ffff00081e935000 2022-05-24T04:06:16 [ 745.325091] x23: ffff800009d3b5b0 x22: ffff0008197d9800 x21: fffffffffffff9b0 2022-05-24T04:06:16 [ 745.332233] x20: ffff00081e934000 x19: ffff00081e935db0 x18: 0000000000000000 2022-05-24T04:06:16 [ 745.339374] x17: 0000000000002000 x16: fffffc00010fffc8 x15: 0000000000000001 2022-05-24T04:06:16 [ 745.346515] x14: 0000000000000002 x13: 00000000000c5a87 x12: ffff0008ff4458c0 2022-05-24T04:06:16 [ 745.353656] x11: ffff0008f95f9668 x10: fffffc0020453a08 x9 : 0000000000000000 2022-05-24T04:06:16 [ 745.360797] x8 : ffff80001c8be000 x7 : 0000000000000000 x6 : 000000000000003f 2022-05-24T04:06:16 [ 745.367938] x5 : 0000000000000040 x4 : 0000000000000000 x3 : ffff80001c8be000 2022-05-24T04:06:16 [ 745.375079] x2 : 0000000000c00000 x1 : 0000000000000000 x0 : ffff80001c5ef198 2022-05-24T04:06:16 [ 745.382221] Call trace: 2022-05-24T04:06:16 [ 745.384662] 0xffffffffffffffe8 2022-05-24T04:06:16 [ 745.387798] vpu_buf_queue+0x314/0x580 2022-05-24T04:06:16 [ 745.391551] __enqueue_in_driver+0x3c/0x6c 2022-05-24T04:06:16 [ 745.395651] vb2_core_qbuf+0x44c/0x5a0 2022-05-24T04:06:16 [ 745.399396] vb2_qbuf+0x94/0xf0 2022-05-24T04:06:16 [ 745.402532] v4l2_ioctl_qbuf+0x1a4/0x29c 2022-05-24T04:06:16 [ 745.406450] v4l_qbuf+0x48/0x60 2022-05-24T04:06:16 [ 745.409586] __video_do_ioctl+0x178/0x3dc 2022-05-24T04:06:16 [ 745.413591] video_usercopy+0x374/0x6a0 2022-05-24T04:06:16 [ 745.417422] video_ioctl2+0x18/0x24 2022-05-24T04:06:16 [ 745.420906] v4l2_ioctl+0x44/0x64 2022-05-24T04:06:16 [ 745.424216] __arm64_sys_ioctl+0xa8/0xf0 2022-05-24T04:06:16 [ 745.428142] invoke_syscall+0x48/0x114 2022-05-24T04:06:16 [ 745.431895] el0_svc_common.constprop.0+0xd4/0xfc 2022-05-24T04:06:16 [ 745.436595] do_el0_svc+0x28/0x90 2022-05-24T04:06:16 [ 745.439905] el0_svc+0x34/0xb0 2022-05-24T04:06:16 [ 745.442955] el0t_64_sync_handler+0xa4/0x130 2022-05-24T04:06:16 [ 745.447220] el0t_64_sync+0x18c/0x190 2022-05-24T04:06:16 [ 745.450884] Code: bad PC value 2022-05-24T04:06:16 [ 745.453940] ---[ end trace 0000000000000000 ]--- 2022-05-24T04:06:16 [ 745.458550] Kernel panic - not syncing: Oops: Fatal exception 2022-05-24T04:06:16 [ 745.464292] SMP: stopping secondary CPUs Signed-off-by: Ming Qian <[email protected]> Reviewed-by: Zhou Peng <[email protected]>
- Loading branch information