linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Stephen Boyd <sboyd@kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH] clk: imx: pll14xx: initialize flags to 0
Date: Tue, 5 Nov 2019 10:04:21 +0000	[thread overview]
Message-ID: <AM0PR04MB4481010CA9D3672F55208092887E0@AM0PR04MB4481.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <5fc2dfd6-ae59-6af8-0423-ddc8e0b4f78f@free.fr>

> Subject: Re: [PATCH] clk: imx: pll14xx: initialize flags to 0
> 
> On 05/11/2019 08:21, Peng Fan wrote:
> 
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > init.flags is initialized with value from pll_clk->flags, however
> > imx_1443x_pll and imx_1416x_pll are not static structure, so flags
> > might be random value. So let's initialize flags as 0 now.
> 
> This is incorrect. When using an initializer list, struct members not explicitly
> specified are initialized to 0.
> 
> https://eur01.safelinks.protection.outlook.com/?url=https:%2F%2Fport70.net
> %2F~nsz%2Fc%2Fc11%2Fn1570.html%236.7.9p19&amp;data=02%7C01%7C
> peng.fan%40nxp.com%7Ca94356700d9c4f61614a08d761d53936%7C686ea1
> d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637085440717516996&amp;s
> data=cUQmXzdbaK6oZqWtJc3Vnh0FJBD1v1b%2FJqb4lRPis5w%3D&amp;rese
> rved=0
> 
> > The initialization shall occur in initializer list order, each
> > initializer provided for a particular subobject overriding any
> > previously listed initializer for the same subobject; all subobjects
> > that are not initialized explicitly shall be initialized implicitly
> > the same as objects that have static storage duration.
> (You might point out that the kernel is compiled with -std=gnu89 not C11, but
> GCC's semantics are the same.)
> 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgcc.gn
> u.org%2Fonlinedocs%2Fgcc%2FDesignated-Inits.html%23Designated-Inits&a
> mp;data=02%7C01%7Cpeng.fan%40nxp.com%7Ca94356700d9c4f61614a08d
> 761d53936%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637085
> 440717516996&amp;sdata=nsiLE%2B91lfZ15zJtvg8D8nJbIpKJkPyaoKBtmMoa
> AwQ%3D&amp;reserved=0

Thanks for the info.

My understanding is wrong.
The patch was initially try to address what [1] did.
In [1], static was discarded and moved to a common place.
So I thought flags should be initialized as 0.

> 
> > diff --git a/drivers/clk/imx/clk-pll14xx.c
> > b/drivers/clk/imx/clk-pll14xx.c index fa76e04251c4..a7f1c1abe664
> > 100644
> > --- a/drivers/clk/imx/clk-pll14xx.c
> > +++ b/drivers/clk/imx/clk-pll14xx.c
> > @@ -65,12 +65,14 @@ struct imx_pll14xx_clk imx_1443x_pll = {
> >  	.type = PLL_1443X,
> >  	.rate_table = imx_pll1443x_tbl,
> >  	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
> > +	.flags = 0,
> >  };
> 
> What tree is this patch based on?

https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/log/?h=for-next

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/commit/?h=for-next&id=43cdaa1567ad3931fbde438853947d45238cc040

Thanks,
Peng.

> 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.b
> ootlin.com%2Flinux%2Fv5.4-rc1%2Fsource%2Fdrivers%2Fclk%2Fimx%2Fclk-p
> ll14xx.c%23L65&amp;data=02%7C01%7Cpeng.fan%40nxp.com%7Ca9435670
> 0d9c4f61614a08d761d53936%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> 0%7C1%7C637085440717516996&amp;sdata=fPeaCJQKsdWZKVG431KNL8v
> hqT0y2TUMMntf1C66YNg%3D&amp;reserved=0
> 
> Regards.

  reply	other threads:[~2019-11-05 10:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  7:21 [PATCH] clk: imx: pll14xx: initialize flags to 0 Peng Fan
2019-11-05  9:47 ` Marc Gonzalez
2019-11-05 10:04   ` Peng Fan [this message]
2019-11-05 10:28     ` Marc Gonzalez
2019-11-05 11:39 ` Abel Vesa
2019-11-05 12:59 ` Ahmad Fatoum
2019-11-06  1:18   ` Peng Fan

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=AM0PR04MB4481010CA9D3672F55208092887E0@AM0PR04MB4481.eurprd04.prod.outlook.com \
    --to=peng.fan@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=marc.w.gonzalez@free.fr \
    --cc=sboyd@kernel.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).