Messages in this thread | | | Date | Wed, 23 Apr 2014 12:42:17 +0100 | From | Mark Brown <> | 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? [unhandled content-type:application/pgp-signature] | |