On Thu, Dec 15, 2016 at 12:28:56PM +0100, Axel Haslam wrote: > + ret = devm_request_threaded_irq(&pdev->dev, > + gpiod_to_irq(drvdata->oc_gpio), NULL, > + reg_fixed_overcurrent_irq, irqflags, > + "over_current", drvdata); > drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc, > &cfg); We are registering a managed interrupt for the interrupt handler and we are registering it before we register the regulator. This means that the interrupt may fire in both probe and remove paths without the regulator which it will then try to use in the interrupt handler, potentially crashing the system. It's better to register the interrupt after the regulator (which will make the managed bit OK) to avoid this possibility.
Attachment:
signature.asc
Description: PGP signature