Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tegra: nvdec: Fix dma_alloc_coherent error check

Check for NULL return value with dma_alloc_coherent, in line with
Robin's fix for vic.c in 'drm/tegra: vic: Fix DMA API misuse'.

Fixes: 46f226c93d35 ("drm/tegra: Add NVDEC driver")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20250702-nvdec-dma-error-check-v1-1-c388b402c53a@nvidia.com

authored by

Mikko Perttunen and committed by
Thierry Reding
44306a68 2e9fdbe5

+2 -4
+2 -4
drivers/gpu/drm/tegra/nvdec.c
··· 261 261 262 262 if (!client->group) { 263 263 virt = dma_alloc_coherent(nvdec->dev, size, &iova, GFP_KERNEL); 264 - 265 - err = dma_mapping_error(nvdec->dev, iova); 266 - if (err < 0) 267 - return err; 264 + if (!virt) 265 + return -ENOMEM; 268 266 } else { 269 267 virt = tegra_drm_alloc(tegra, size, &iova); 270 268 if (IS_ERR(virt))