Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp504000ybc; Tue, 12 Nov 2019 05:03:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxW1ezXt8sdFmD32pOUY320ehRRiM89VTRQ7MNlPiCr4n151tRULl0LNZs1sohtGRSjIrvG X-Received: by 2002:aa7:c756:: with SMTP id c22mr32132883eds.25.1573563823496; Tue, 12 Nov 2019 05:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573563823; cv=none; d=google.com; s=arc-20160816; b=XjZQ2peF/wrfmPSPQN6xEQiEjKWJnlof7DLoOZ3PH07ILdHOdrsYgbEBiFFVWDqOLp rky4zmc1fFOP/bD8ZRoLiTv8NYnAvk3wQRvwGVdvqmuA9bBYWQRKDETreuimH3VaTve5 bqui6aUfifNCzvYg8ds3I9GYjOFA71bKL/n2TuVvYV+wOd3CXsFzLs7BAx7w7coSLW6H OCsGnY/Ng411JsTLK22aDVjgH4jc34RCFx4eH0IOh6xdA0GfYhPCHS3AiGAnUAWNeDjJ aH4K7ElANZ5JaFb3PNJnw5XD3FdtW2pu8qjb1yRmFhsqcaBcyH3JUM3FXpPuIDvyNn3K eXIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to:date; bh=A5HVOB5ajxkqPad/bNlr6F1RNw3isdOpneG+rO8rBM8=; b=xcq/TWAAw6XOnHL0mPjjlszkQAAxob9EH/hpkEU8Z4lmjTOdYkT1N3HVc8eDPL/EeR dElzw8+ABEIgclBJmaqn/ejzuY5N06BXi0Z3tkqCdgzwKBXzhvqY8WyfrJraHUkcQoBR 2jzf5En8PJVVoNoe3eoewofVivC0jrjX4QnD5InbcIvZ+nN7FyI24iNwdrJpVwbeo7EP A8p1EdefRdwhlQmrQKAtkgWnl/67gpHlnzbPMmXLXeWbZh5Tc/8TZZZea/TISv4kISxp s6cozvpPl7/ly/GsMvjX7MppSKPnuA6KrMt+H65wxWRi6E5Pi1ddSxPU9C6rqrbEjVg5 K6ww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si5556250ejo.137.2019.11.12.05.03.17; Tue, 12 Nov 2019 05:03:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727233AbfKLNAj convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Nov 2019 08:00:39 -0500 Received: from hermes.aosc.io ([199.195.250.187]:46121 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfKLNAi (ORCPT ); Tue, 12 Nov 2019 08:00:38 -0500 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id DB3C040E63; Tue, 12 Nov 2019 13:00:36 +0000 (UTC) Date: Tue, 12 Nov 2019 20:59:56 +0800 In-Reply-To: <20191111123936.GM4345@gilmour.lan> References: <20191111123936.GM4345@gilmour.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH] clk: sunxi-ng: v3s: Fix incorrect number of hw_clks. To: linux-arm-kernel@lists.infradead.org, Maxime Ripard , Tian Yunhao CC: Stephen Boyd , Michael Turquette , "linux-kernel@vger.kernel.org" , Chen-Yu Tsai , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" From: Icenowy Zheng Message-ID: <1FA73EE3-CED2-4241-839D-51C8C02531F5@aosc.io> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 于 2019年11月11日 GMT+08:00 下午8:39:36, Maxime Ripard 写到: >Hi, > >Thanks for your patch > >On Sat, Nov 09, 2019 at 03:19:09PM +0000, Tian Yunhao wrote: >> The hws field of sun8i_v3s_hw_clks has only 74 >> members. However, the number specified by CLK_NUMBER >> is 77 (= CLK_I2S0 + 1). This leads to runtime segmentation >> fault that is not always reproducible. >> >> This patch adds a protective field [CLK_NUMBER] which ensures >> ARRAY_SIZE(.hws) is always greater than .num, thus eliminates >> this error. >> >> Signed-off-by: Yunhao Tian >> --- >> drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c >b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c >> index 5c779eec454b..de7fce7f32e6 100644 >> --- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c >> +++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c >> @@ -617,6 +617,7 @@ static struct clk_hw_onecell_data >sun8i_v3s_hw_clks = { >> [CLK_AVS] = &avs_clk.common.hw, >> [CLK_MBUS] = &mbus_clk.common.hw, >> [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, >> + [CLK_NUMBER] = NULL, >> }, >> .num = CLK_NUMBER, >> }; >> @@ -699,6 +700,7 @@ static struct clk_hw_onecell_data >sun8i_v3_hw_clks = { >> [CLK_AVS] = &avs_clk.common.hw, >> [CLK_MBUS] = &mbus_clk.common.hw, >> [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, >> + [CLK_NUMBER] = NULL, >> }, >> .num = CLK_NUMBER, > >I'd rather have the number of clocks (.num) being properly set. However the maximum clock indices number is different on V3s and V3, because on V3s the last clock is missing. Should we define CLK_NUMBER_V3S here? > >Maxime