# When the camera is disconnected or not connected to orin, kernel panic may occur, causing the system to reset

**URL:** <https://forums.developer.nvidia.com/t/when-the-camera-is-disconnected-or-not-connected-to-orin-kernel-panic-may-occur-causing-the-system-to-reset/317977>\
**Category:** Jetson AGX Orin\
**Tags:** camera\
**Created:** [December 25, 2024, 6:55am UTC](https://forums.developer.nvidia.com/t/when-the-camera-is-disconnected-or-not-connected-to-orin-kernel-panic-may-occur-causing-the-system-to-reset/317977 "2024-12-25T06:55:30Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![MushroomHunter](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/mushroomhunter/32/330425_2.png) [@MushroomHunter](https://forums.developer.nvidia.com/u/MushroomHunter)\
**Post date:** [January 3, 2025, 5:30am UTC](https://forums.developer.nvidia.com/t/when-the-camera-is-disconnected-or-not-connected-to-orin-kernel-panic-may-occur-causing-the-system-to-reset/317977/17 "2025-01-03T05:30:31Z")

</div>

The patch in this thread fixes this problem.  
[https://forums.developer.nvidia.com/t/orin-vi5-channel-stop-kernel-panic-on-jetpack5-1-1/258971/7](https://forums.developer.nvidia.com/t/orin-vi5-channel-stop-kernel-panic-on-jetpack5-1-1/258971/7)  
But after running for 6 hours, the following error will be printed.

```auto
[21111.532847] tegra_channel_kthread_capture_enqueue:[vi-output, isx031 7-0030]->[21111008285070] - [21108455357441] = 2552927629 ns
[21111.532909] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,240
[21111.532914] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,242
[21111.532915] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,245
[21111.532917] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,248
[21111.532918] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,251
[21111.532919] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,254
[21111.532920] tegra194-vi5 13e00000.host1x:vi0@15c00000: vi_channel_close_ex,257
[21111.538410] tegra-camrtc-capture-vi tegra-capture-vi: dma_alloc_coherent failed
[21111.538415] tegra-camrtc-capture-vi tegra-capture-vi: fatal: error recovery failed

```

I looked at the code and found that there is no code to release chan-\>request[vi\_port] in vi5\_channel\_error\_recover, which will cause a memory leak.

There is only tegra\_channel\_capture\_setup in vi5\_channel\_error\_recover, but no related release function. But I found that there is a corresponding release function in vi5\_channel\_stop\_streaming.

```auto
				dma_free_coherent(chan->tegra_vi_channel[vi_port]->rtcpu_dev,
				chan->capture_queue_depth * sizeof(struct capture_descriptor),
				chan->request[vi_port], chan->request_iova[vi_port]);

```

So is this a code logic bug?  
Also, will the patches in this post be reflected in new versions later?

> [@Orin vi5\_channel\_stop kernel panic on jetpack5.1.1](https://forums.developer.nvidia.com/t/orin-vi5-channel-stop-kernel-panic-on-jetpack5-1-1/258971/18):
>
> hello mmcly, would you please update the kernel image to add below patch for capture-ivc.c. for example, diff --git a/drivers/platform/tegra/rtcpu/capture-ivc-priv.h b/drivers/platform/tegra/rtcpu/capture-ivc-priv.h index 04c95aef3..f6cb92497 100644 --- a/drivers/platform/tegra/rtcpu/capture-ivc-priv.h +++ b/drivers/platform/tegra/rtcpu/capture-ivc-priv.h @@ -37,6 +37,7 @@ struct tegra\_capture\_ivc\_cb\_ctx { tegra\_capture\_ivc\_cb\_func cb\_func; /\*\* Private context of a VI/ISP capt…

---

_[View the full topic](https://forums.developer.nvidia.com/t/when-the-camera-is-disconnected-or-not-connected-to-orin-kernel-panic-may-occur-causing-the-system-to-reset/317977)._
