From patchwork Wed Dec 13 22:41:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 10111013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4152A60352 for ; Wed, 13 Dec 2017 22:41:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3553328AAC for ; Wed, 13 Dec 2017 22:41:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A3AF28F75; Wed, 13 Dec 2017 22:41:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF62C28AAC for ; Wed, 13 Dec 2017 22:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbdLMWla (ORCPT ); Wed, 13 Dec 2017 17:41:30 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33700 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752909AbdLMWlW (ORCPT ); Wed, 13 Dec 2017 17:41:22 -0500 Received: by mail-pf0-f193.google.com with SMTP id y89so2205476pfk.0 for ; Wed, 13 Dec 2017 14:41:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zcmq7LN6XwZSTJJcZ3bU/gby1PmpQujyigPB6KR2Kcg=; b=YyEEZakfzjIQvHKvjP0CzkOA7XpRTu4YwMLjikZWmgf5/jgEINZ6zo47ERyxDQ8Y3o 6NOu+y6+Xaz01Pmo6tuY7KiBWXnkBRSujpVO2hSeaPJZqK6A+sbJd0edxyDpYHBD/oZk VOL6CVbR4o1uvVS6XViIZf7Km/a9pZIYg+8r0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Zcmq7LN6XwZSTJJcZ3bU/gby1PmpQujyigPB6KR2Kcg=; b=a0yK8OgjlHuRIKKM65IjubaVYJNY2bLNdg+eUDtW6H8VGjxwf79PuGsaJSRQu17Xxd hRcMqg8SMO9RBYHJFr6174r/pyfMsfGtng3jMn0r7M1ov7kWvGtexDB0spZlUzNgXtHw 3bLPhCadsmTkX2Vb3KGxOJxLM19euQXYr0EP4bvfCx4Sqvnj+BUyQ2RDqBOJPBMVljtQ 501kWgLIe13DKDr1TU1wWFDG+2MKmbFhYGjBVFmuxbcPqkxR58Aoqiom7jJApvMCFQoc yEQbuhrqrrVJPSOU2WMh5Cui21g7ehOLoymVXj7BZvMiDvi+gorHHObNfgA0sRTCooYp zxYw== X-Gm-Message-State: AKGB3mJZHCTKF/VTyKkA58dKsbfK/szoAtnpQogxgCqLswDXuXQ2H2Kb Dg/Au911CGLkI8kMCqgq3Q1rig== X-Google-Smtp-Source: ACJfBosjyk/MEbluksjP3mTnBXDR2OMEeQJbYtBZ6A3qZ8AFEZU+JK+opG80pzcqMT/CIIBlRBgvOA== X-Received: by 10.98.111.137 with SMTP id k131mr7543707pfc.105.1513204881787; Wed, 13 Dec 2017 14:41:21 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id x15sm4464205pfh.27.2017.12.13.14.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 14:41:21 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/8] remoteproc: Don't handle empty resource table Date: Wed, 13 Dec 2017 14:41:08 -0800 Message-Id: <20171213224111.17864-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171213224111.17864-1-bjorn.andersson@linaro.org> References: <20171213224111.17864-1-bjorn.andersson@linaro.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 f2b6aa5d204c..63d88d1d206e 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;