2019-11-05 07:22:29

by Peng Fan

[permalink] [raw]
Subject: [PATCH] clk: imx: pll14xx: initialize flags to 0

From: Peng Fan <[email protected]>

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.

Signed-off-by: Peng Fan <[email protected]>
---
drivers/clk/imx/clk-pll14xx.c | 2 ++
1 file changed, 2 insertions(+)

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,
};

struct imx_pll14xx_clk imx_1416x_pll = {
.type = PLL_1416X,
.rate_table = imx_pll1416x_tbl,
.rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
+ .flags = 0,
};

static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
--
2.16.4


2019-11-05 11:43:11

by Abel Vesa

[permalink] [raw]
Subject: Re: [PATCH] clk: imx: pll14xx: initialize flags to 0

On 19-11-05 07:21:08, Peng Fan wrote:
> From: Peng Fan <[email protected]>
>
> 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.
>
> Signed-off-by: Peng Fan <[email protected]>

Reviewed-by: Abel Vesa <[email protected]>

> ---
> drivers/clk/imx/clk-pll14xx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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,
> };
>
> struct imx_pll14xx_clk imx_1416x_pll = {
> .type = PLL_1416X,
> .rate_table = imx_pll1416x_tbl,
> .rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
> + .flags = 0,
> };
>
> static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
> --
> 2.16.4
>

2019-11-05 13:01:40

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH] clk: imx: pll14xx: initialize flags to 0

Hello Peng,

On 11/5/19 8:21 AM, Peng Fan wrote:
> From: Peng Fan <[email protected]>
>
> init.flags is initialized with value from pll_clk->flags, however
> imx_1443x_pll and imx_1416x_pll are not static structure,

They don't have a static in front of them, but they still have static
storage duration.

> so flags
> might be random value. So let's initialize flags as 0 now.

I fail to see how. Members not listed in the { initializer-list } are
implicitly initialized as if they were static objects, so flags should
already be zero.

(I assumed this patch is based on Shawn's imx-clk-5.5 tag)

Cheers
Ahmad


>
> Signed-off-by: Peng Fan <[email protected]>
> ---
> drivers/clk/imx/clk-pll14xx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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,
> };
>
> struct imx_pll14xx_clk imx_1416x_pll = {
> .type = PLL_1416X,
> .rate_table = imx_pll1416x_tbl,
> .rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
> + .flags = 0,
> };
>
> static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
>

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2019-11-06 01:21:51

by Peng Fan

[permalink] [raw]
Subject: RE: [PATCH] clk: imx: pll14xx: initialize flags to 0

> Subject: Re: [PATCH] clk: imx: pll14xx: initialize flags to 0
>
> Hello Peng,
>
> On 11/5/19 8:21 AM, Peng Fan wrote:
> > From: Peng Fan <[email protected]>
> >
> > init.flags is initialized with value from pll_clk->flags, however
> > imx_1443x_pll and imx_1416x_pll are not static structure,
>
> They don't have a static in front of them, but they still have static storage
> duration.

Yes. I am wrong.

>
> > so flags
> > might be random value. So let's initialize flags as 0 now.
>
> I fail to see how. Members not listed in the { initializer-list } are implicitly
> initialized as if they were static objects, so flags should already be zero.

Understand.

>
> (I assumed this patch is based on Shawn's imx-clk-5.5 tag)

Yes.

Drop this patch.

Thanks,
Peng.

>
> Cheers
> Ahmad
>
>
> >
> > Signed-off-by: Peng Fan <[email protected]>
> > ---
> > drivers/clk/imx/clk-pll14xx.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > 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,
> > };
> >
> > struct imx_pll14xx_clk imx_1416x_pll = {
> > .type = PLL_1416X,
> > .rate_table = imx_pll1416x_tbl,
> > .rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
> > + .flags = 0,
> > };
> >
> > static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
> >
>
> --
> Pengutronix e.K. |
> |
> Industrial Linux Solutions |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.p
> engutronix.de%2F&amp;data=02%7C01%7Cpeng.fan%40nxp.com%7Cd19f6f7
> 6f49e40ed516108d761eff88d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> 0%7C1%7C637085555604797300&amp;sdata=MVUvIPUFpkhLj6KDs1Za2sBU
> FNPMrWvS9vA9BuxqQ3k%3D&amp;reserved=0 |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0
> |
> Amtsgericht Hildesheim, HRA 2686 | Fax:
> +49-5121-206917-5555 |