lkml.org 
[lkml]   [2014]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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?
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-04-23 15:41    [W:0.179 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site