[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140423114217.GW12304@sirena.org.uk>
Date: Wed, 23 Apr 2014 12:42:17 +0100
From: Mark Brown <broonie@...nel.org>
To: Lee Jones <lee.jones@...aro.org>
Cc: Michal Simek <michal.simek@...inx.com>,
linux-kernel@...r.kernel.org, monstr@...str.eu,
pankaj.dubey@...sung.com, Samuel Ortiz <sameo@...ux.intel.com>,
arnd@...db.de
Subject: Re: [PATCH v3] mfd: syscon: Support early initialization
On Wed, Apr 23, 2014 at 11:05:30AM +0100, Lee Jones wrote:
> > +struct regmap *syscon_early_regmap_lookup_by_phandle(struct device_node *np,
> > + const char *property)
> > +{
> > + struct device_node *syscon_np;
> > + struct syscon *syscon;
> > +
> > + syscon_np = of_parse_phandle(np, property, 0);
> > + if (!syscon_np)
> > + return ERR_PTR(-ENODEV);
> > +
> > + syscon = syscon_np->data;
> > +
> > + of_node_put(syscon_np);
> > +
> > + return syscon->regmap;
> > +}
> > +EXPORT_SYMBOL_GPL(syscon_early_regmap_lookup_by_phandle);
I don't know what this is doing but it looks dodgy, we're returning
something stored in the DT node after dropping our reference to the DT
node. For FDT systems this probably makes no difference since we don't
actually free the node but someone might decide to do something like
clear data that's associated with a node (however that happened) when
the node goes unreferenced.
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - if (!res)
> > - return -ENOENT;
> > + *syscon_p = (struct syscon *)&syscon;
What's this cast for?
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists