Skip to content

Commit

Permalink
ipu6-isys: Fix ipu_isys_probe() error exit resource cleanup
Browse files Browse the repository at this point in the history
Add a bunch of missing resource cleanups to ipu_isys_probe()'s
error exit path.

Also add a missing mutex_destroy() to isys_remove()

Signed-off-by: Hans de Goede <[email protected]>
  • Loading branch information
jwrdegoede committed Mar 6, 2024
1 parent 5df050d commit baf00fd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/media/pci/intel/ipu-isys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ static void isys_remove(struct ipu_bus_device *adev)

mutex_destroy(&isys->stream_mutex);
mutex_destroy(&isys->mutex);
mutex_destroy(&isys->lib_mutex);

if (isys->short_packet_source == IPU_ISYS_SHORT_PACKET_FROM_TUNIT) {
u32 trace_size = IPU_ISYS_SHORT_PACKET_TRACE_BUFFER_SIZE;
Expand Down Expand Up @@ -1587,6 +1588,16 @@ static int isys_probe(struct ipu_bus_device *adev)
isys_iwake_watermark_cleanup(isys);
isys_unregister_devices(isys);
out_remove_pkg_dir_shared_buffer:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
cpu_latency_qos_remove_request(&isys->pm_qos);
#else
pm_qos_remove_request(&isys->pm_qos);
#endif
ipu_trace_uninit(&adev->dev);
#ifdef CONFIG_DEBUG_FS
if (isp->ipu_dir)
debugfs_remove_recursive(isys->debugfsdir);
#endif
if (!isp->secure_mode)
ipu_cpd_free_pkg_dir(adev, isys->pkg_dir,
isys->pkg_dir_dma_addr,
Expand All @@ -1597,10 +1608,10 @@ static int isys_probe(struct ipu_bus_device *adev)
release_firmware:
if (!isp->secure_mode)
release_firmware(isys->fw);
ipu_trace_uninit(&adev->dev);

mutex_destroy(&isys->mutex);
mutex_destroy(&isys->stream_mutex);
mutex_destroy(&isys->lib_mutex);

if (isys->short_packet_source == IPU_ISYS_SHORT_PACKET_FROM_TUNIT)
mutex_destroy(&isys->short_packet_tracing_mutex);
Expand Down

0 comments on commit baf00fd

Please sign in to comment.