From patchwork Fri Jan 5 23:58:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 123574 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1428201qgn; Fri, 5 Jan 2018 15:58:24 -0800 (PST) X-Google-Smtp-Source: ACJfBouXS7ouG+jRPn2YaXaU5KglkJIJ2XFln4fVMQ6ZD/BTDpPEWKY00LM163FXp4ssnsWOW1Kh X-Received: by 10.98.111.200 with SMTP id k191mr4453404pfc.75.1515196704384; Fri, 05 Jan 2018 15:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515196704; cv=none; d=google.com; s=arc-20160816; b=1LGsnVKk2K2kjKmEv5zNfkLKOw/p2EsxRFIet7vvpzMqPmsVebzxKdnSxXb+hQCXXz n2BYdhncSYVhBOC80TIY0yQLwvSFJqLf49mToa+G85rqigPp47Ui4ryCqb9aQlv9Pu+r MhWBJffAm0D9BhEcb6KkJo9UMHoVHEaNs5GfmODa3ZlZHKK4dLgXkyl18qucQ0zyD73T Ue+T+Cn/fuEvOk2gH/2tktADgV5NmEewBSSdtwZKO+NwAcT5LxMqdb8opOZdHQjLWOXA G1gkmmeblLwyFnZRCrQX3LQWuaBr9FZ0JZSUwuOhtdHh4SXz7MNjMpnSgSXGGN4rYW2r BDlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=nWwXEBhoA7y6hYbvILx1bdPCbR83/acQmwWJfbBNYTU=; b=OdoE46F2IXy6u63D4anhgFwvsO7FiP5QayF1rrXZS5fyBDiISje0/1FdheqOpQj/4l 85B2UrvfBqWmDD7PGIY+VOf/pFa1XktFdXomrQCV270wMEYq2d+f6822JWrnt/xxmI/P DSUGXomhZ78I/3lxkeDszPM671Ce1CT+dBB4pFtuRIZHDeZ/VbyUU4jPbD/p9AAFAAFN RP/XRUMtSkMRYAK+YbWp8DaZ7A7O+KYTWws71l6JmyQ2tz6BA66YJXcAbdVe4b9X9QXO BhNCZz5VuuRFEl+Uj27R7F/exZxmqyCXaKa0gGivl0x5tfaxQy8eBIKobMeBE4SKRf+U PqEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LPZl+QH1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 98si4705984pls.543.2018.01.05.15.58.24; Fri, 05 Jan 2018 15:58:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LPZl+QH1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753413AbeAEX6W (ORCPT + 28 others); 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 Received: by mail-pl0-f66.google.com with SMTP id g2so3980506pli.8 for ; Fri, 05 Jan 2018 15:58:16 -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=nWwXEBhoA7y6hYbvILx1bdPCbR83/acQmwWJfbBNYTU=; b=LPZl+QH17WQiCzbErkQNn21skdyG4OC7tXz1qNp4/Pg3pRtxIDsONJ8HZVLzj5Vv7d ayjDXg1ONYW1fQdTQFYuWPJCuCC9H9TEDlB72/R6k59b0X8QVzXiRG+bWdfzGXj3qZee Yi5Clz/cLtomk15JU/2sfqlS6hNBLklzibqlY= 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=nWwXEBhoA7y6hYbvILx1bdPCbR83/acQmwWJfbBNYTU=; b=oCjg6bdPNdDG3Ey8Oq6WbF8AAVzuhuUIr2daGHfROCvpdd6dJNv8QzNtMLjdDAgl8j HlTMJ72YRctyN344i8d0wMuIfvjSFBlgXEoEZU0UbQQAX4SuzJMXgdHjGLqFKEYz/DiF pPAymQUGCO/rxPF8XRk+RcARYjF9OzA72xTHecwn65jfXplGb5E3Pb3S/pC5/vYTy7k1 p98zJ3xdWKj7N8zQtK71SsI/jrJ8Af+GRvfMSNivT8rL0MASEsqOi7j/pBNx7UPf1vuj hpWNte8gPxeni8txnUmDgwTUXk7Youi/npRdgAKLPdcJDl05vWtB/wB6S7BHLw2MKCL7 RltQ== X-Gm-Message-State: AKGB3mJY0HhAJUQz3dFAy/lGXszCTkt3kk8qKVbaU4CV1t9aqD2mceE5 jLTBnjZaKC5ez99UabdrKVxviA== X-Received: by 10.84.128.15 with SMTP id 15mr775106pla.417.1515196695681; Fri, 05 Jan 2018 15:58:15 -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 x4sm14473188pfk.51.2018.01.05.15.58.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 15:58:14 -0800 (PST) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.15.0 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;