[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120502100225.GB24211@n2100.arm.linux.org.uk>
Date: Wed, 2 May 2012 11:02:25 +0100
From: Russell King - ARM Linux <linux@....linux.org.uk>
To: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Saravana Kannan <skannan@...eaurora.org>,
Mike Turquette <mturquette@...aro.org>,
Arnd Bergman <arnd.bergmann@...aro.org>,
linux-arm-kernel@...ts.infradead.org, Andrew Lunn <andrew@...n.ch>,
Paul Walmsley <paul@...an.com>,
Linus Walleij <linus.walleij@...ricsson.com>,
Stephen Boyd <sboyd@...eaurora.org>,
linux-arm-msm@...r.kernel.org,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Magnus Damm <magnus.damm@...il.com>,
linux-kernel@...r.kernel.org,
Rob Herring <rob.herring@...xeda.com>,
Richard Zhao <richard.zhao@...aro.org>,
Grant Likely <grant.likely@...retlab.ca>,
Deepak Saxena <dsaxena@...aro.org>,
Amit Kucheria <amit.kucheria@...aro.org>,
Jamie Iles <jamie@...ieiles.com>,
Jeremy Kerr <jeremy.kerr@...onical.com>,
Thomas Gleixner <tglx@...utronix.de>,
Shawn Guo <shawn.guo@...escale.com>
Subject: Re: [PATCH] clk: Use a separate struct for holding init data.
On Wed, May 02, 2012 at 11:58:16AM +0200, Sascha Hauer wrote:
> > diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
> > index 6e58f11..8e97491 100644
> > --- a/drivers/clk/clk-mux.c
> > +++ b/drivers/clk/clk-mux.c
> > @@ -95,6 +95,7 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
> > {
> > struct clk_mux *mux;
> > struct clk *clk;
> > + struct clk_init_data init;
> >
> > /* allocate the mux */
> > mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
> > @@ -103,6 +104,12 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
> > return ERR_PTR(-ENOMEM);
> > }
> >
> > + init.name = name;
> > + init.ops = &clk_mux_ops;
> > + init.flags = flags;
> > + init.parent_names = parent_names;
> > + init.num_parents = num_parents;
> > +
> > /* struct clk_mux assignments */
> > mux->reg = reg;
> > mux->shift = shift;
> > @@ -110,8 +117,7 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
> > mux->flags = clk_mux_flags;
> > mux->lock = lock;
>
> There is a mux->hw.init = &init missing here.
What happens to mux->hw.init long term? Because once this function
returns, that pointer will no longer be valid. It would be a good
idea to NULL it out in clk_register() once its done with, to ensure
that no one comes up with the idea of using it later.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists