1

remoteproc: mediatek: Fix error code in scp_rproc_init()

Set the error code to ERR_PTR(-ENOMEM).  Otherwise if there is an
allocation failure it leads to a NULL dereference in the caller.

Fixes: c08a824945 ("remoteproc: mediatek: Support setting DRAM and IPI shared buffer sizes")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/b2114e3c-fa64-4edb-a1ff-d2009e544c3f@moroto.mountain
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
Dan Carpenter 2024-05-04 14:26:46 +03:00 committed by Mathieu Poirier
parent 3c8a9066d5
commit 47558cbaa8

View File

@ -1156,6 +1156,7 @@ static struct mtk_scp *scp_rproc_init(struct platform_device *pdev,
scp->share_buf = kzalloc(scp_sizes->ipi_share_buffer_size, GFP_KERNEL);
if (!scp->share_buf) {
dev_err(dev, "Failed to allocate IPI share buffer\n");
ret = -ENOMEM;
goto release_dev_mem;
}