video: rockchip: mpp: fix enc crash when reset

rootcause:
Access NULL rkvenc_ccu in some no ccu platform.

[ 1591.262830][ T105] CPU: 2 PID: 105 Comm: mpp_worker_1 Tainted: G OE 6.1.90-android14-11-g0a5333c8b527-ab12287675 #1
[ 1591.264400][ T105] Hardware name: Rockchip RK3562 EVB2 DDR4 V10 Board (DT)
[ 1591.265037][ T105] pstate: 604000c5 (nZCv daIF +PAN UAO -TCO -DIT -SSBS BTYPE=-)
[ 1591.265732][ T105] pc : _raw_spin_lock_irqsave+0x80/0xb0
[ 1591.266299][ T105] lr : rkvenc_reset+0x17c/0x3bc [rk_vcodec]
[ 1591.267258][ T105] sp : ffffffc00a96bc50
[ 1591.267629][ T105] x29: ffffffc00a96bc50 x28: 0000000000000000 x27: ffffffc001b89000
[ 1591.268366][ T105] x26: 0000000000000100 x25: ffffffc001b89000 x24: ffffffc001baafb0
[ 1591.269085][ T105] x23: 0000000000000000 x22: ffffff800b436c40 x21: ffffffc001b89000
[ 1591.269795][ T105] x20: 000000000000002c x19: 0000000000000000 x18: ffffffc00a88d040
[ 1591.270511][ T105] x17: 00000000a488ebfc x16: 00000000a488ebfc x15: 0000000000000004
[ 1591.271230][ T105] x14: ffffffc009fefd88 x13: 00000000000890f2 x12: 0000000029aaaaab
[ 1591.271951][ T105] x11: 0000000000000000 x10: 0000000000000001 x9 : 0000000000000000
[ 1591.272669][ T105] x8 : 0000000000000050 x7 : 205b5d3830333431 x6 : 322e31393531205b
[ 1591.273395][ T105] x5 : 0000000000000024 x4 : 0000000000000000 x3 : ffffffc0088f9b58
[ 1591.274116][ T105] x2 : ffffffc00a6a1128 x1 : 0000000000000000 x0 : 0000000000000050
[ 1591.274837][ T105] Call trace:
[ 1591.275147][ T105] _raw_spin_lock_irqsave+0x80/0xb0
[ 1591.275794][ T105] rkvenc_reset+0x17c/0x3bc [rk_vcodec]
[ 1591.280105][ T105] mpp_dev_reset+0x120/0x19c [rk_vcodec]
[ 1591.280811][ T105] mpp_task_finish+0x84/0x1c4 [rk_vcodec]
[ 1591.281461][ T105] rkvenc_isr+0xdc/0x2c0 [rk_vcodec]
[ 1591.282112][ T105] mpp_task_worker_default+0x128/0x5bc [rk_vcodec]
[ 1591.282945][ T105] kthread_worker_fn+0x10c/0x244
[ 1591.283472][ T105] kthread+0x104/0x1d4
[ 1591.283886][ T105] ret_from_fork+0x10/0x20
[ 1591.284319][ T105] Code: d65f03c0 aa1f03e9 5280002a f9800111 (885ffd01)
[ 1591.284950][ T105] ---[ end trace 0000000000000000 ]---

Change-Id: Ia8c5c66c1e07a3181210e7428889f6428c33f546
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
This commit is contained in:
Yandong Lin
2024-10-08 11:39:34 +08:00
committed by Tao Huang
parent c1558a5266
commit 42ce77d846

View File

@@ -2214,12 +2214,12 @@ static int rkvenc_reset(struct mpp_dev *mpp)
set_bit(mpp->core_id, &queue->core_idle);
spin_lock_irqsave(&ccu->lock_dchs, flags);
if (ccu) {
spin_lock_irqsave(&ccu->lock_dchs, flags);
ccu->dchs[mpp->core_id].val[0] = 0;
ccu->dchs[mpp->core_id].val[1] = 0;
spin_unlock_irqrestore(&ccu->lock_dchs, flags);
}
spin_unlock_irqrestore(&ccu->lock_dchs, flags);
mpp_dbg_core("core %d reset idle %lx\n", mpp->core_id, queue->core_idle);