Re: [RESEND PATCHv3 2/2] regulator: fixed: Handle optional overcurrent pin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux