Re: [PATCH] regulator: core: Get and put regulator of_node

From: Charles Keepax
Date: Wed Apr 02 2014 - 12:05:17 EST

On Wed, Apr 02, 2014 at 03:23:56PM +0100, Mark Brown wrote:
> On Wed, Apr 02, 2014 at 03:06:54PM +0100, Charles Keepax wrote:
> > We should be incrementing the reference count of the of_node for the
> > regulator when we take a copy of it. This patch does so.
> Why?
> Note that in any case this is going to have absolutely no impact on
> practical systems since everything using regulators uses FDT at the
> minute.

Apologies I must be missing something, take for example the fixed
regulator driver (fixed.c). We get an of_node from
pdev->dev->of_node, pull the init_data from it, then copy the
of_node into the regulator_config and call regulator_register.
regulator_register will copy the of_node from the regulator_config
and put it into the new device, but as far as I can see no one ever
incremented the reference count?

of_node = pdev->dev.of_node;

drvdata->dev = regulator_register(&drvdata->desc, &cfg);

Looks like there are a couple of other regulator drivers in the
same boat. Just seems easier to let the core do the reference
stuff rather than needing to do it in the drivers.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at