From patchwork Fri Mar 31 13:04:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9656323 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 F0EA7601D2 for ; Fri, 31 Mar 2017 13:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3801285EF for ; Fri, 31 Mar 2017 13:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D85B628618; Fri, 31 Mar 2017 13:05:35 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 942D6285EF for ; Fri, 31 Mar 2017 13:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754885AbdCaNFf (ORCPT ); Fri, 31 Mar 2017 09:05:35 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:36413 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932999AbdCaNET (ORCPT ); Fri, 31 Mar 2017 09:04:19 -0400 Received: by mail-wr0-f177.google.com with SMTP id w11so104283424wrc.3 for ; Fri, 31 Mar 2017 06:04:18 -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=EbZsAADS/ZMsY9CDoyuKsyZD+qNl1YpV0ZpW1m8tt88=; b=JFI0NObCHcCbiv7xdHNnRzOUAPiYQyYtb+uBESenG3FY482t6Bs9DXs9S0FFBQOkho w/15ntUIWOCifVfELUixGAwmF0BDFe1vu0iZAhXbxI3omSl7n8Yqy/FJhHjjwHj3qlSu neIi7QdLluuWwXTiGmAnVQeJsrnkGHVvXwJLB2p0u8u3jrWU54K4PbRblL0jkgVZM5aB p+CLW4mWTln7AHMCQb1u1wD4ASWcJySduMTS7oiNaMBKNFaYTi4ZaXrCaMikDEnMw1R2 1NYkK/qt7Jzi0oulnKBaWouOX/JjpoLUOgDegE3N6YKJWSSHq0LGB4gBe66rowXVTcCA RKVg== 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=EbZsAADS/ZMsY9CDoyuKsyZD+qNl1YpV0ZpW1m8tt88=; b=kGtSibKYG1uwEbXL+JPiZJeiEp++oY+Ica8Z0+vk4KBsx4dFIBhRI95n1kTIzLl1iK uQLkJYaLX2h+xvN7IoSe0eSBoibJKhcjnNeM5gXvof85b/kP4/6sm0GhcZ9Yxcau3k/C 0rg1jNez0TROW+8kvE8xtzE2+BCzm/pAyi6TZ9+cdX5sGhFp2EUWiPLLThv7ZuEql50K 9FsVJ/tpw/kkWVAb/hGxQxATI1Tw5bEfqPb7XoLSXjG/8L9oimVeZhI/2qqNWlEIhrga WdJQgJDPFan0n0NQjRySN9d942eAri2ToTgkro/gZ/ix1ZeOfPgW5kipewKorzqjXFNu cwLA== X-Gm-Message-State: AFeK/H0uQFzGkiT0Kl1OqPmvHKhwuavpQ3i13BvBLoBkCiVrtmpeeKtsSt47eoxbgCFIiOn5 X-Received: by 10.28.137.211 with SMTP id l202mr2870664wmd.118.1490965457530; Fri, 31 Mar 2017 06:04:17 -0700 (PDT) Received: from localhost.localdomain (uluru.liltaz.com. [163.172.81.188]) by smtp.googlemail.com with ESMTPSA id 189sm2844439wmm.31.2017.03.31.06.04.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Mar 2017 06:04:17 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong , 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 v2 2/8] clk: meson: gxbb: protect against holes in the onecell_data array Date: Fri, 31 Mar 2017 15:04:05 +0200 Message-Id: <20170331130411.4781-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170331130411.4781-1-jbrunet@baylibre.com> References: <20170331130411.4781-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. Acked-by: Michael Turquette 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)