Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remoteproc: fix memory issue if load resource table failed #362

Merged
merged 1 commit into from
Mar 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/remoteproc/remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,20 @@ static void *remoteproc_get_rsc_table(struct remoteproc *rproc,
if (ret < 0 || ret < (int)len || !img_data) {
metal_log(METAL_LOG_ERROR,
"get rsc failed: 0x%llx, 0x%llx\r\n", offset, len);
rsc_table = RPROC_ERR_PTR(-RPROC_EINVAL);
ret = -RPROC_EINVAL;
goto error;
}
memcpy(rsc_table, img_data, len);

ret = handle_rsc_table(rproc, rsc_table, len, NULL);
if (ret < 0) {
rsc_table = RPROC_ERR_PTR(ret);
goto error;
}
return rsc_table;

error:
metal_free_memory(rsc_table);
return rsc_table;
return RPROC_ERR_PTR(ret);
}

static int remoteproc_parse_rsc_table(struct remoteproc *rproc,
Expand Down