Readd "msm: kgsl: Fix Z180 memory leak""

Decerement entry refcount, which incremented
in kgsl_sharedmem_find_region.

CRs-Fixed: 635747
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
This reverts commit 3d829f33a9b7ecce31ec5303958f7edbc740fbe7.

Change-Id: Ib29f1db8e71e81f4ddcd8d9d7f415e4da55c3479
Readd "msm: kgsl: Fix mem leak when page allocation fails""

Page allocation may fail during OOM condition. Update
sglen and size to correct value (allocated) so that
they get freed in kgsl_sharedmem_free().

Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
This reverts commit 388b7ed2427c3febaac990ffcde9843e643a1ce8.

Change-Id: Ic5ec252c080aa86993b6802d91e2b281be81b1c3
msm: camera: fix null pointer
Prevent a Kernel panic that can be triggered after shooting an
HDR picture.

Change-Id: I72bb125e1ab04c8c98589922da6513d28acc6cb3
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cma: Remove potential deadlock situation

A report was given of a deadlock situation on the cma_mutex:

mutex_lock(cma_mutex)   (*2)
dma_release_from_contiguous
ion_secure_cma_free_chunk
ion_secure_cma_shrinker
shrink_slab
try_to_free_pages
migrate_pages
alloc_contig_range
mutex_lock(cma_mutex)  (*1)
dma_alloc_from_contiguous
ion_alloc

We may need to free CMA allocations while a current CMA allocation is in
progress if CMA is freed from a shrinker. cma_mutex currently protects
two things: the bitmap indicating which pages are allocated/free and
serialization of isolation/migration calls on allocation. There is
no need to take the mutex on free calls though as the pages are
freed back into the system via the regular __free_page call. Move
the free_contig_range call outside the cma_mutex to break the
chain dependency. We can safely free the pages back into the system
before changing the bitmap without any risk of races.

Change-Id: I4989eb2891e502b08db8117a51bd86652e902778
CRs-Fixed: 619644
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>