On Thu, May 03, 2012 at 05:05:33PM +0200, Guennadi Liakhovetski wrote:
> devres_destroy() doesn't call the release() method, it only destroys the
> resource. The caller should take care to release the associated object
> itself.

> +     regulator_put(regulator);
>       rc = devres_destroy(regulator->dev, devm_regulator_release,
>                           devm_regulator_match, regulator);

Oh dear.  This seems like pretty peculiar behaviour on the part of
devres_destroy() - everything about the function and its documentation
would suggest that it'd actually free the resource not just free the
devm_ internal bits of the resource, and especially given that we have
to pass the release function in.

This also seems like it's the wrong way round - it probably shouldn't
matter that much but we should really only do the regulator_put() after
the destroy succeeded since there's a small chance that hotplug or
something might cause this to run while the device is being removed
elsewhere so we could end up trying to double free.

Also, this patch is totally unrelated to the rest of the series and
should really have been sent separately.

Attachment: signature.asc
Description: Digital signature

Reply via email to