From: Maxime Ripard <mripard@kernel.org>
To: Icenowy Zheng <icenowy@aosc.io>
Cc: linux-arm-kernel@lists.infradead.org,
Tian Yunhao <t123yh@outlook.com>, Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Chen-Yu Tsai <wens@csie.org>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>
Subject: Re: [PATCH] clk: sunxi-ng: v3s: Fix incorrect number of hw_clks.
Date: Tue, 12 Nov 2019 20:16:18 +0100 [thread overview]
Message-ID: <20191112191618.GC4345@gilmour.lan> (raw)
In-Reply-To: <1FA73EE3-CED2-4241-839D-51C8C02531F5@aosc.io>
[-- Attachment #1: Type: text/plain, Size: 2000 bytes --]
On Tue, Nov 12, 2019 at 08:59:56PM +0800, Icenowy Zheng wrote:
>
>
> 于 2019年11月11日 GMT+08:00 下午8:39:36, Maxime Ripard <mripard@kernel.org> 写到:
> >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 <t123yh@outlook.com>
> >> ---
> >> 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?
That, or we can just reference the last clock, we're not using
CLK_NUMBER anywhere else.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2019-11-12 19:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BN8PR08MB57792366D78997180A698AF8897A0@BN8PR08MB5779.namprd08.prod.outlook.com>
2019-11-11 12:39 ` [PATCH] clk: sunxi-ng: v3s: Fix incorrect number of hw_clks Maxime Ripard
2019-11-12 12:59 ` Icenowy Zheng
2019-11-12 19:16 ` Maxime Ripard [this message]
2019-11-25 12:58 Yunhao Tian
2019-11-28 17:44 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191112191618.GC4345@gilmour.lan \
--to=mripard@kernel.org \
--cc=icenowy@aosc.io \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=t123yh@outlook.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).