Skip to content

Commit

Permalink
media: rockchip: vicap fixed segfault when call shutdown function
Browse files Browse the repository at this point in the history
[  177.363952][    C0] SError Interrupt on CPU0, code 0xbe000011 -- SError
[  177.363954][    C0] CPU: 0 PID: 1 Comm: init Not tainted 5.10.66 #68
[  177.363956][    C0] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[  177.363958][    C0] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[  177.363959][    C0] pc : disable_irq+0x10/0xa0
[  177.363960][    C0] lr : csi2_shutdown+0x50/0x6c
[  177.363961][    C0] sp : ffffffc01211bc20
[  177.363963][    C0] x29: ffffffc01211bc50 x28: ffffff8100b98040
[  177.363967][    C0] x27: 0000000000000000 x26: ffffffc011f7e000
[  177.363970][    C0] x25: ffffffc012099000 x24: ffffff8103325890
[  177.363973][    C0] x23: ffffff8103325818 x22: ffffffc011e48988
[  177.363976][    C0] x21: ffffff8103325810 x20: ffffffc01183bdf0
[  177.363979][    C0] x19: ffffff8107785088 x18: ffffffc012115050
[  177.363982][    C0] x17: 0000000000000009 x16: 0000000000000009
[  177.363985][    C0] x15: 0000000000000000 x14: fffffffeffe00000
[  177.363988][    C0] x13: 0000000000019ba0 x12: 0000000029aaaaf1
[  177.363991][    C0] x11: 001e33635ac745bd x10: ffffffc013790028
[  177.363994][    C0] x9 : ffffffc01379002c x8 : 00000000ffffffff
[  177.363997][    C0] x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000040
[  177.364000][    C0] x5 : 0000000000190018 x4 : ffffff8103d19980
[  177.364003][    C0] x3 : ffffff8100003c90 x2 : 0000000000000001
[  177.364006][    C0] x1 : 0000000000000002 x0 : 000000000000003f
[  177.364010][    C0] Kernel panic - not syncing: Asynchronous SError Interrupt
[  177.364011][    C0] CPU: 0 PID: 1 Comm: init Not tainted 5.10.66 #68
[  177.364013][    C0] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[  177.364014][    C0] Call trace:
[  177.364015][    C0]  dump_backtrace+0x0/0x1c8
[  177.364016][    C0]  show_stack+0x1c/0x2c
[  177.364017][    C0]  dump_stack_lvl+0xdc/0x12c
[  177.364018][    C0]  dump_stack+0x1c/0x64
[  177.364019][    C0]  panic+0x150/0x3a4
[  177.364020][    C0]  test_taint+0x0/0x30
[  177.364022][    C0]  arm64_serror_panic+0x78/0x84
[  177.364023][    C0]  do_serror+0xe0/0x100
[  177.364024][    C0]  el1_error+0x94/0x118
[  177.364025][    C0]  disable_irq+0x10/0xa0
[  177.364026][    C0]  platform_drv_shutdown+0x24/0x34
[  177.364028][    C0]  device_shutdown+0x174/0x214
[  177.364029][    C0]  kernel_restart+0x44/0x110
[  177.364030][    C0]  __arm64_sys_reboot+0x148/0x21c
[  177.364031][    C0]  el0_svc_common+0xc0/0x23c
[  177.364032][    C0]  do_el0_svc+0x28/0x88
[  177.364033][    C0]  el0_svc+0x14/0x24
[  177.364035][    C0]  el0_sync_handler+0x88/0xec
[  177.364036][    C0]  el0_sync+0x1a8/0x1c0
[  177.365312][    C0] rockchip-thermal fec00000.tsadc: channal 0: temperature(35 C)

Fixes: 3435f13 ("media: rockchip: vicap add shutdown function")
Signed-off-by: Zefa Chen <[email protected]>
Change-Id: I58a76ac614c1a0ad13cf67a8001f6e9ee3d06fe8
  • Loading branch information
Zefa Chen authored and rkhuangtao committed Apr 13, 2022
1 parent 445bc9a commit efee59b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
7 changes: 6 additions & 1 deletion drivers/media/platform/rockchip/cif/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,9 @@ static void rkcif_hw_shutdown(struct platform_device *pdev)
struct rkcif_device *cif_dev = NULL;
int i = 0;

if (pm_runtime_get_if_in_use(&pdev->dev) <= 0)
return;

if (cif_hw->chip_id == CHIP_RK3588_CIF ||
cif_hw->chip_id == CHIP_RV1106_CIF) {
write_cif_reg(cif_hw->base_addr, 0, 0);
Expand All @@ -1314,7 +1317,9 @@ static void rkcif_hw_shutdown(struct platform_device *pdev)
}
}
}
disable_irq(cif_hw->irq);
if (cif_hw->irq > 0)
disable_irq(cif_hw->irq);
pm_runtime_put(&pdev->dev);
}

static int __maybe_unused rkcif_runtime_suspend(struct device *dev)
Expand Down
11 changes: 0 additions & 11 deletions drivers/media/platform/rockchip/cif/mipi-csi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,16 +919,6 @@ static int csi2_probe(struct platform_device *pdev)
return ret;
}

static void csi2_shutdown(struct platform_device *pdev)
{
struct v4l2_subdev *sd = platform_get_drvdata(pdev);
struct csi2_dev *csi2 = sd_to_dev(sd);

csi2_disable(csi2);
disable_irq(csi2->irq1);
disable_irq(csi2->irq2);
}

static int csi2_remove(struct platform_device *pdev)
{
struct v4l2_subdev *sd = platform_get_drvdata(pdev);
Expand All @@ -948,7 +938,6 @@ static struct platform_driver csi2_driver = {
},
.probe = csi2_probe,
.remove = csi2_remove,
.shutdown = csi2_shutdown,
};

int __init rkcif_csi2_plat_drv_init(void)
Expand Down

0 comments on commit efee59b

Please sign in to comment.