Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp220382rwd; Mon, 12 Jun 2023 12:28:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6D5IWt6MFBoPZhrchllf9qcwV/ijMwrZ62DWBwKITxyoj7j45AbxXEI/eXhcN6P4y4e6yK X-Received: by 2002:a17:907:6e07:b0:974:545d:cfa3 with SMTP id sd7-20020a1709076e0700b00974545dcfa3mr9875400ejc.64.1686598110194; Mon, 12 Jun 2023 12:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686598110; cv=none; d=google.com; s=arc-20160816; b=Oyfx3E4Z6EsJeYNn9SDTOL7RIVuwPxRd7EGRK6ZAPNaQb4QhiSKpkRvAsdinL7T8Qv Cd5mYMDG2t5N6UD+M4J5BEdRncSpjo97uDkhSLD78uqfV7kgR+Gm/HCCJ49HXAMAvXi1 O115LNdMiF+wqV3xoB1oLgg0EzUr5zkjUPvSVzgJHd8+dVOGZQqC4yL0EebAmXtlPrdb tT2QjkA7xEZfzh7AlCI3gM4zUwiyf424szBhGLAM+Cca4hs/HQGsJmK7FZNshZCSfbu4 DMxk12Gjo3PsVYA4xsNS1vIlul8iQv/OnSBhrhoO8ksfwL/JU9jgWSJyuDdmnOsUoggH eAfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=Uc8NHmZrhy6yWJZPnSwFVGuxyMJkfyfpfEtq2e0p/u0=; b=NdbcY/fcNNyjR6vek8zdhA8ntzRjEUWwO+EKB6HFJDGU1HoJLN5g4BKQpOxNm88VxI jrA5X4wuriGKoZGZEBzAVkQbYYrRn9GynZ4v4icYI18HTO8qcNIef3ViKHK9jrKHJbvt 4CgvLxSfCNRhMffDUOys0jX3faeOWvqp+VeVTBABQUSnL2KkVzbZnHG/MqGcwyA3h2Pq jG+fMIc6nqLgIVpN4Je3awhq2lpnhuuf9lfE/+n5cgr0VGw1zFZ6Koy7ZyDmAquqB7f1 km2akiwGTzlBbtSDHiHY0D1+/sHLiA0XLN01QzvMRlcqLLRYb8A2khINRAo831AD4Mjf hUMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bi2/l7I3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx8-20020a170906af0800b0096aae0b3695si6237257ejb.84.2023.06.12.12.28.04; Mon, 12 Jun 2023 12:28:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bi2/l7I3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234484AbjFLTWW (ORCPT + 99 others); Mon, 12 Jun 2023 15:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjFLTWU (ORCPT ); Mon, 12 Jun 2023 15:22:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAF8EB5; Mon, 12 Jun 2023 12:22:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 77E3260FE4; Mon, 12 Jun 2023 19:22:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D019DC433D2; Mon, 12 Jun 2023 19:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686597738; bh=i1X/5SIkx3TUQH2BftjUID6RqLc4AaNJ8SVBxImU+qM=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=bi2/l7I3uexfPYcwzwPjmP6WlInrVSOIEPErDHEfmau5FFgzTv3XURlQ+XrDoOhqR BNeWLd4rf47bCIVqERocPaVAZtBvSONw8W8uqjG07XKI53IceZJsdRSsTu0kXdVGSf AA6ZqVIB50Pqg5I2rADg/IaqWRza3RPDVSCrqJsUrdiEUg5E6b4i+ArFwKKHbduA8O xbk5glj70s1aLaOgIsgNvtIwR2tw1uS6Udl/nAEQOlH5T/Nl43Vq599cgJqub29A8G Ul8iJDHEk9iUsUj/KuMRa/lT3TlreilB0X96l4Yp5LvIKCZYkA4u1xPPgwwazfR/sq oCXuKjX6fW+Rg== Message-ID: <83fa171f45654606c1911d2c0d8b5871.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230517-fix-clk-index-v3-1-be4df46065c4@baylibre.com> References: <20230517-fix-clk-index-v3-1-be4df46065c4@baylibre.com> Subject: Re: [PATCH v3] clk: mediatek: mt8365: Fix index issue From: Stephen Boyd Cc: Conor Dooley , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Alexandre Mergnat To: Alexandre Mergnat , AngeloGioacchino Del Regno , Chen-Yu Tsai , Matthias Brugger , Michael Turquette Date: Mon, 12 Jun 2023 12:22:16 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Alexandre Mergnat (2023-05-26 06:10:43) > Before the patch [1], the clock probe was done directly in the > clk-mt8365 driver. In this probe function, the array which stores the > data clocks is sized using the higher defined numbers (*_NR_CLOCK) in > the clock lists [2]. Currently, with the patch [1], the specific > clk-mt8365 probe function is replaced by the mtk generic one [3], which > size the clock data array by adding all the clock descriptor array size > provided by the clk-mt8365 driver. >=20 > Actually, all clock indexes come from the header file [2], that mean, if > there are more clock (then more index) in the header file [2] than the > number of clock declared in the clock descriptor arrays (which is the > case currently), the clock data array will be undersized and then the > generic probe function will overflow when it will try to write in > "clk_data[CLK_INDEX]". Actually, instead of crashing at boot, the probe > function returns an error in the log which looks like: > "of_clk_hw_onecell_get: invalid index 135", then this clock isn't > enabled. >=20 > Solve this issue by adding in the driver the missing clocks declared in > the header clock file [2]. >=20 > [1]: Commit ffe91cb28f6a ("clk: mediatek: mt8365: Convert to > mtk_clk_simple_{probe,remove}()") > [2]: include/dt-bindings/clock/mediatek,mt8365-clk.h > [3]: drivers/clk/mediatek/clk-mtk.c >=20 > Fixes: ffe91cb28f6a ("clk: mediatek: mt8365: Convert to mtk_clk_simple_{p= robe,remove}()") >=20 > Signed-off-by: Alexandre Mergnat > --- Applied to clk-fixes