diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-12-06 17:37:24 +0300 |
---|---|---|
committer | Maxime Ripard <mripard@kernel.org> | 2023-12-08 12:25:24 +0300 |
commit | fca9448ae2f5ddebd841c727ee86136e1b5cbd86 (patch) | |
tree | ad121dda94daca43ca1aaff6878afcda7c01dc0e /drivers/gpu/drm/imagination | |
parent | b84135e7a5921a79e3dc0cc1bbfbe9c3c661c8d0 (diff) | |
download | linux-fca9448ae2f5ddebd841c727ee86136e1b5cbd86.tar.xz |
drm/imagination: Move dereference after NULL check in pvr_mmu_backing_page_init()
This code dereferences "page->pvr_dev" and then checked for NULL on the
next line. Re-order it to avoid a potential NULL pointer dereference.
Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/13f4278e-af9c-4092-9196-bc0e6b76f1eb@moroto.mountain
Diffstat (limited to 'drivers/gpu/drm/imagination')
-rw-r--r-- | drivers/gpu/drm/imagination/pvr_mmu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/imagination/pvr_mmu.c b/drivers/gpu/drm/imagination/pvr_mmu.c index c8562bfc0dcd..4fe70610ed94 100644 --- a/drivers/gpu/drm/imagination/pvr_mmu.c +++ b/drivers/gpu/drm/imagination/pvr_mmu.c @@ -316,12 +316,14 @@ err_free_page: static void pvr_mmu_backing_page_fini(struct pvr_mmu_backing_page *page) { - struct device *dev = from_pvr_device(page->pvr_dev)->dev; + struct device *dev; /* Do nothing if no allocation is present. */ if (!page->pvr_dev) return; + dev = from_pvr_device(page->pvr_dev)->dev; + dma_unmap_page(dev, page->dma_addr, PVR_MMU_BACKING_PAGE_SIZE, DMA_TO_DEVICE); |