OSDN Git Service

remoteproc: Don't handle empty resource table
authorBjorn Andersson <bjorn.andersson@linaro.org>
Fri, 5 Jan 2018 23:58:02 +0000 (15:58 -0800)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Mon, 15 Jan 2018 17:29:48 +0000 (09:29 -0800)
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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/remoteproc_core.c

index 2c669a7..3160cfe 100644 (file)
@@ -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;