atomisp: handle allocation calls before init in the hmm layer
authorAlan Cox <alan@linux.intel.com>
Fri, 28 Apr 2017 12:09:23 +0000 (13:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Apr 2017 12:27:25 +0000 (14:27 +0200)
Currently the code handles this in the abstraction above. We want to remove
that abstraction so begin by pushing down the sanity check. Unfortunately
at this point we can't simply fix the init order.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c

index 151abf0b70b741664a86c890b2cc56011b97e08a..14537ab3d04be448ae3a79d1448883b1b99cc25c 100644 (file)
@@ -226,6 +226,11 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
        struct hmm_buffer_object *bo;
        int ret;
 
+       /* Check if we are initialized. In the ideal world we wouldn't need
+          this but we can tackle it once the driver is a lot cleaner */
+
+       if (!dummy_ptr)
+               hmm_init();
        /*Get page number from size*/
        pgnr = size_to_pgnr_ceil(bytes);