Since the dma_alloc_coherent() may return NULL, the pointer returned needs to be checked to avoid null-poineter dereference. Fixes: 46f226c93d35 ("drm/tegra: Add NVDEC driver") Signed-off-by: Zeng Heng <zengheng4@xxxxxxxxxx> --- drivers/gpu/drm/tegra/nvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c index 276fe0472730..4f667fb502d8 100644 --- a/drivers/gpu/drm/tegra/nvdec.c +++ b/drivers/gpu/drm/tegra/nvdec.c @@ -216,6 +216,8 @@ static int nvdec_load_firmware(struct nvdec *nvdec) } else { virt = tegra_drm_alloc(tegra, size, &iova); } + if (IS_ERR_OR_NULL(virt)) + return -ENOMEM; nvdec->falcon.firmware.virt = virt; nvdec->falcon.firmware.iova = iova; -- 2.25.1