Re: [RESEND PATCHv3 2/2] regulator: fixed: Handle optional overcurrent pin
From: Axel Haslam <hidden>
Date: 2016-12-15 13:03:40
On Thu, Dec 15, 2016 at 1:19 PM, Mark Brown [off-list ref] wrote:
On Thu, Dec 15, 2016 at 12:28:56PM +0100, Axel Haslam wrote:quoted
+ ret = devm_request_threaded_irq(&pdev->dev, + gpiod_to_irq(drvdata->oc_gpio), NULL, + reg_fixed_overcurrent_irq, irqflags, + "over_current", drvdata);quoted
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.
will fix, and send v4. Regards, Axel. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html