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: 9656307 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 E609860352 for ; Fri, 31 Mar 2017 13:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8441285EF for ; Fri, 31 Mar 2017 13:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD25528618; Fri, 31 Mar 2017 13:04:55 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E99DD2860D for ; Fri, 31 Mar 2017 13:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=u7Yaqj8sO6uGhSpGoLQfFkt0u4CfsdMrAmdgeSppxWo=; b=L4iVkpNEmV5A8HuW0Mh8tPyjME RBFuaH15VMkrknjkm7ZpWWF25VeN5nFxoOpEdAmDJfPRE7qAxC3Pv0lxJJw5NeegWwVJ2hlLNI3NR 7R9AohEeuI9jAtY50Ch7HpRijtc9CknIhvmO7GqRBHvPQTGWwePUi+xzM2Y38X8MfA5hnfQSJKLwI 5IDvK+TCzKEL49fV7jkxyJSHuSeu3mSG3UyfJAp2GnnDj19QPew4qR0Aqm9KZj5LMxr4TM5eO6vzv UzgLziuivSEptWEb0R1ZQZIz3W/8+y7KBeyuIdBez3HstrjhcJhZ9UPxCj1SVH3lwz5HHjFwFLcRL 0qitawzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctwEN-0002vo-1l; Fri, 31 Mar 2017 13:04:43 +0000 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctwEJ-0002sg-K0 for linux-amlogic@lists.infradead.org; Fri, 31 Mar 2017 13:04:41 +0000 Received: by mail-wr0-x22f.google.com with SMTP id k6so100026183wre.2 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=SkNUe0ppWofa94lqrX7mIcu4LhJ+KdspFJFMl7L8FKQEL6W6o6ZLcEAPaLP5lJwnW/ UQ0zxmiiVnl0WxOsUkLS/JMIT+xv9zjFm+XQxr0/WtRSTHTeNqZ6OouizW3iEZxcX37k 3VhFbc82MIAdM7gJBc6zPTqqhKNgsqY9TL0dpCUE67j+w0I4j4TTRyVF0saI77lF44Sb A8Nl4AVX/jdfjCdqDwInDOhwIMuCE9eczjOY9+IITRaL2rGMl0FBuwxy1BKL1hrJtGUS t3yLkQcBE67FSu+yT94LQQvFG9JoCJSBb01epgCp72eK0ICf2xbUMFXuWGdno+y6Mnvg uSpA== X-Gm-Message-State: AFeK/H1eH4rBhfOumHmjUHSoesx9JbjKIGhzDf2FqMhchGhxlMgGa5+0bUcBb3ARnJbmHLaV 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170331_060439_834402_260C48E4 X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.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)