On Fri, Aug 19, 2016 at 12:26:42AM +0100, Russell King - ARM Linux wrote:
So this allows me to test a bit more... and there's more bad news. On re-inserting this module...
Looks like removing and re-inserting these modules has never been tested. :( And oh my...
static int omap_mcpdm_probe(struct snd_soc_dai *dai) { ret = devm_request_irq(mcpdm->dev, mcpdm->irq, omap_mcpdm_irq_handler, 0, "McPDM", (void *)mcpdm);
static struct snd_soc_dai_driver omap_mcpdm_dai = { .probe = omap_mcpdm_probe, .remove = omap_mcpdm_remove,
Using devm_* stuff in a context where it doesn't get automatically freed when the DAI driver is unbound, and nothing in omap_mcpdm_remove() to undo that request.
Yes, that's obviously bad - and in any case we should request resources at the device model level regardless of that.
I suspect that isn't the full story though, because of the regmap complaint (which I've not even looked at yet.)
Missed that one?
Maybe we should have a test mode in the kernel where every device goes through a bind-unbind-rebind sequence during boot to test more of these paths...
That actually came up independently the other day during the Kernel Summit discussions, Rob Herring gave it a bit of a go but I'm not sure if he did it with a view to upstreaming or anything. It's definitely a good idea, as I said on that thread I think deferred probe has been one of the best things to ever happen to kernel error handling and this would just extend it.