Commit 4eab8c0e authored by Thierry Reding's avatar Thierry Reding

drm/tegra: falcon: Fix error handling

The ->alloc() callback in struct falcon_ops returns an ERR_PTR()-encoded
error code on failure, so it needs to be properly checked for, otherwise
subsequent code may dereference an invalid pointer.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 0dc34e19
...@@ -141,9 +141,9 @@ int falcon_load_firmware(struct falcon *falcon) ...@@ -141,9 +141,9 @@ int falcon_load_firmware(struct falcon *falcon)
/* allocate iova space for the firmware */ /* allocate iova space for the firmware */
falcon->firmware.vaddr = falcon->ops->alloc(falcon, firmware->size, falcon->firmware.vaddr = falcon->ops->alloc(falcon, firmware->size,
&falcon->firmware.paddr); &falcon->firmware.paddr);
if (!falcon->firmware.vaddr) { if (IS_ERR(falcon->firmware.vaddr)) {
dev_err(falcon->dev, "dma memory mapping failed\n"); dev_err(falcon->dev, "DMA memory mapping failed\n");
return -ENOMEM; return PTR_ERR(falcon->firmware.vaddr);
} }
/* copy firmware image into local area. this also ensures endianness */ /* copy firmware image into local area. this also ensures endianness */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment