OSDN Git Service

media: atomisp: warn if mipi de-allocation failed
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 16 Nov 2021 09:13:32 +0000 (09:13 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 16 Nov 2021 14:37:10 +0000 (14:37 +0000)
There's a note at the uninit function that warns about issues
with mipi frames de-allocation. print a warning if the problem
ever happens.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/sh_css.c
drivers/staging/media/atomisp/pci/sh_css_mipi.c
drivers/staging/media/atomisp/pci/sh_css_mipi.h

index 12dfecb..8bcf610 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "hmm.h"
 
+#include "atomisp_internal.h"
+
 #include "ia_css.h"
 #include "sh_css_hrt.h"                /* only for file 2 MIPI */
 #include "ia_css_buffer.h"
@@ -2286,7 +2288,9 @@ ia_css_uninit(void)
        sh_css_params_free_default_gdc_lut();
 
        /* TODO: JB: implement decent check and handling of freeing mipi frames */
-       //assert(ref_count_mipi_allocation == 0); //mipi frames are not freed
+       if (!mipi_is_free())
+               dev_warn(atomisp_dev, "mipi frames are not freed.\n");
+
        /* cleanup generic data */
        sh_css_params_uninit();
        ia_css_refcount_uninit();
index 87f1df5..cfaa471 100644 (file)
@@ -261,6 +261,17 @@ mipi_init(void)
                ref_count_mipi_allocation[i] = 0;
 }
 
+bool mipi_is_free(void)
+{
+       unsigned int i;
+
+       for (i = 0; i < N_CSI_PORTS; i++)
+               if (ref_count_mipi_allocation[i])
+                       return false;
+
+       return true;
+}
+
 int
 calculate_mipi_buff_size(
     struct ia_css_stream_config *stream_cfg,
index 52f08a1..dffec22 100644 (file)
@@ -23,6 +23,8 @@
 void
 mipi_init(void);
 
+bool mipi_is_free(void);
+
 int
 allocate_mipi_frames(struct ia_css_pipe *pipe, struct ia_css_stream_info *info);