Re: [linux-sunxi] Re: [PATCH v4 01/11] clk: sunxi: Add display and TCON0 clocks driver

From: Priit Laes
Date: Wed May 11 2016 - 23:39:37 EST


On Wed, 2016-05-11 at 15:15 -0700, Stephen Boyd wrote:
> On 05/10, Priit Laes wrote:
> >
> > On Mon, 2016-05-09 at 15:39 -0700, Stephen Boyd wrote:
> > >
> > > On 05/09, Stephen Boyd wrote:
> > > >
> > > >
> > > >
> > > > Ok I applied this one to clk-next.
> > > >
> > > And I squashed this in to silence the following checker warning.
> > >
> > > drivers/clk/sunxi/clk-sun4i-display.c:110:33: warning: Variable
> > > length array is used.
> > >
> > > ---8<---
> > > diff --git a/drivers/clk/sunxi/clk-sun4i-display.c
> > > b/drivers/clk/sunxi/clk-sun4i-display.c
> > > index f02e250e64ed..f8ff6c4a5633 100644
> > > --- a/drivers/clk/sunxi/clk-sun4i-display.c
> > > +++ b/drivers/clk/sunxi/clk-sun4i-display.c
> > > @@ -107,7 +107,7 @@ static int
> > > sun4i_a10_display_reset_xlate(struct
> > > reset_controller_dev *rcdev,
> > > Âstatic void __init sun4i_a10_display_init(struct device_node
> > > *node,
> > > Â ÂÂconst struct
> > > sun4i_a10_display_clk_data *data)
> > > Â{
> > > - const char *parents[data->parents];
> > > + const char *parents[4];
> > This change breaks at least de_[bf]e clocks which have 3 clock
> > parents.

> I just used the largest data->parents number, which was 4. How
> does that break anything?

If you look at theÂsun4i_a10_display_init, it contains this block:

  ret = of_clk_parent_fill(node, parents, ARRAY_SIZE(parents));
ÂÂÂÂif (ret != ARRAY_SIZE(parents)) {
ÂÂÂÂÂÂÂÂpr_err("%s: Could not retrieve the parents\n", clk_name);
ÂÂÂÂÂÂÂÂgoto unmap;
ÂÂÂÂ}

of_clk_parent_fill returns 3 for de_be/de_fe nodes, and
ARRAY_SIZE(parents) is 4.

PÃikest,
Priit :)