drm/cma-helper: Fix drm_gem_cma_free_object()
authorNoralf Trønnes <noralf@tronnes.org>
Fri, 26 Apr 2019 12:47:53 +0000 (14:47 +0200)
committerNoralf Trønnes <noralf@tronnes.org>
Wed, 8 May 2019 14:01:40 +0000 (16:01 +0200)
commit23e35c0eb81a23d40c079a7eb187fc321fa1deb7
tree3a79e89d4bb59a2223f1cb54a2b81e1d9b78196b
parent0cbd0adc4429930567083d18cc8c0fbc5f635d96
drm/cma-helper: Fix drm_gem_cma_free_object()

The logic for freeing an imported buffer with a virtual address is
broken. It will free the buffer instead of unmapping the dma buf.
Fix by reversing the if ladder and first check if the buffer is imported.

Fixes: b9068cde51ee ("drm/cma-helper: Add DRM_GEM_CMA_VMAP_DRIVER_OPS")
Cc: stable@vger.kernel.org
Reported-by: "Li, Tingqian" <tingqian.li@intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190426124753.53722-1-noralf@tronnes.org
drivers/gpu/drm/drm_gem_cma_helper.c