From patchwork Tue Mar 28 14:45:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9649841 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 6FAB56034B for ; Tue, 28 Mar 2017 14:46:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6267F26E56 for ; Tue, 28 Mar 2017 14:46:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5759428414; Tue, 28 Mar 2017 14:46:44 +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 027A6283E8 for ; Tue, 28 Mar 2017 14:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbdC1Oql (ORCPT ); Tue, 28 Mar 2017 10:46:41 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:32870 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752805AbdC1Oqj (ORCPT ); Tue, 28 Mar 2017 10:46:39 -0400 Received: by mail-wr0-f172.google.com with SMTP id w43so93603907wrb.0 for ; Tue, 28 Mar 2017 07:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VcqRbppXG/EuthPFat0yZNfgAHVZhp0/vfLGmVmHnJs=; b=TjHhP+zgKZj8u6rERxHZUL8qlRk3XhG8U1LZuqP5dN2zuOMxW8D2KTLEo5RcOTZy24 RlryynaAh+13C7HkCjHzn0Pa56Cun0IIpQIbgYfmQGdDjycCz8xGiAjeeaUvjQc4LvSh xbS+1OYGoXXhM+uUGMr1/aRIYmSy+hAroHO33IUPidPd0ov+J4ZUXVQ4RvIbk9/sbDwm Zn3K/krsPsqAGLsl4fqucEL444LBcQQpilpKVzG4cq/7bj+DiDuX3dqdcaGfqeuPZ8GW j54GdJbRPr53tBsPHNjnP/+ECXXk0pqG06RIC/kxaTJT1UKvp+IElKB0mFLrQ/29AQkS ABNg== 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=VcqRbppXG/EuthPFat0yZNfgAHVZhp0/vfLGmVmHnJs=; b=rS+bpZFHa4sApi6U+JlhK9LQ9YQKObOl6ybbfSDG/scJ+sSRKt6NPT4f9B9Z6OC8Si RSZ4v7LVmSv7q/7FlFB3UHVIG8SUFkC4nQtqJVREPlyvhcnJXw1VLuC1OXJ8ECh39rss fxgqfAIVPkN+YUWNYj0kqiNP7nvbQWd6GP5gumH3JY3bQeUMXLG5sFzpsuqyJzHJSzkf NSsajvhBpqS32Ei8sN7eOtI0hgN+BuVM9QFlaCoDplhJYVOpRTz8HcXRp68E4trfQmKt 6GBll6Dc+M9Hm5fE9StGjc3SaUyQZVDAlhkJBc25fSixuPAAGhPRBDytTruzX4VLZ4rB T4aw== X-Gm-Message-State: AFeK/H0gws1J6ViMDEq1JnLOGHYKBMepNEeOfGeRlCpFpy77xEOM5z00dxkfQkj1pAV03XLv X-Received: by 10.223.152.43 with SMTP id v40mr23775471wrb.60.1490712373338; Tue, 28 Mar 2017 07:46:13 -0700 (PDT) Received: from localhost.localdomain (cag06-3-82-243-161-21.fbx.proxad.net. [82.243.161.21]) by smtp.googlemail.com with ESMTPSA id a18sm5159457wrc.58.2017.03.28.07.46.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 07:46:12 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Kevin Hilman , Carlo Caione Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/8] clk: meson: gxbb: protect against holes in the onecell_data array Date: Tue, 28 Mar 2017 16:45:59 +0200 Message-Id: <20170328144605.25278-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170328144605.25278-1-jbrunet@baylibre.com> References: <20170328144605.25278-1-jbrunet@baylibre.com> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The clock controller is getting more complex and it might be possible, in the future, to have holes in the clk_hw_onecell_data array. Just make sure we skip those holes if it ever happens. Signed-off-by: Jerome Brunet --- drivers/clk/meson/gxbb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 75197664a7ee..28812ea41a60 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -1388,6 +1388,10 @@ static int gxbb_clkc_probe(struct platform_device *pdev) * register all clks */ for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) { + /* array might be sparse */ + if (!clkc_data->hw_onecell_data->hws[clkid]) + continue; + ret = devm_clk_hw_register(dev, clkc_data->hw_onecell_data->hws[clkid]); if (ret)