From: Bjorn Andersson Date: Fri, 5 Jan 2018 23:58:02 +0000 (-0800) Subject: remoteproc: Don't handle empty resource table X-Git-Tag: v4.16-rc1~63^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4bb86f2c39cdd31338dd0274540596aa9ae82c3;p=thirdparty%2Fkernel%2Flinux.git remoteproc: Don't handle empty resource table Allow a NULL table_ptr to have the same meaning as a table with 0 entries, allowing a subsequent patch to skip the assignment step. A few other places in the implementation does dereference table_ptr, but they are currently all coming from rproc_handle_resources(). Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 2c669a73e77dc..3160cfe897da1 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -739,6 +739,9 @@ static int rproc_handle_resources(struct rproc *rproc, rproc_handle_resource_t handler; int ret = 0, i; + if (!rproc->table_ptr) + return 0; + for (i = 0; i < rproc->table_ptr->num; i++) { int offset = rproc->table_ptr->offset[i]; struct fw_rsc_hdr *hdr = (void *)rproc->table_ptr + offset;