Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753413AbeAEX6W (ORCPT + 1 other); Fri, 5 Jan 2018 18:58:22 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:41393 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752956AbeAEX6Q (ORCPT ); Fri, 5 Jan 2018 18:58:16 -0500 X-Google-Smtp-Source: ACJfBosa7GKeWklChEE+AY4aOsMAG02KTi3Ck7nhe57I1W9d5PFyH4M6v7+j8acQIdJ8W4MTqMqpow== From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Loic Pallardy Subject: [PATCH v2 5/8] remoteproc: Don't handle empty resource table Date: Fri, 5 Jan 2018 15:58:02 -0800 Message-Id: <20180105235805.9948-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180105235805.9948-1-bjorn.andersson@linaro.org> References: <20180105235805.9948-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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(). Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/remoteproc/remoteproc_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 2c669a73e77d..3160cfe897da 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; -- 2.15.0