Re: [PATCH RESEND 1/2] regulator: arizona-ldo1: Improve handling of regulator unbinding

From: Mark Brown
Date: Wed Jan 22 2020 - 08:11:54 EST


On Wed, Jan 22, 2020 at 11:08:41AM +0000, Charles Keepax wrote:

> The current unbinding process for Madera has some issues. The trouble
> is runtime PM is disabled as the first step of the process, but

Why not just leave runtime PM active until all the subdevices are gone?
This is a really bad hack and it's going to be fragile.

> +static int madera_ldo1_remove(struct platform_device *pdev)
> +{
> + struct madera *madera = dev_get_drvdata(pdev->dev.parent);
> +
> + if (madera->internal_dcvdd) {
> + regulator_disable(madera->dcvdd);
> + regulator_put(madera->dcvdd);
> + }

This is going to break bisection since it will result in double
disables, it'd be fine to do the MFD change first since that'd just
leak a reference to enable on a regulator which is about to be discarded
entirely anyway but this reordering (and whatever other changes you've
done since v1) means you add a double free.

Attachment: signature.asc
Description: PGP signature