Messages in this thread | | | Subject | Re: [PATCH 3/3] ipmi:bt-bmc: Fix error handling and status check | From | Tang Bin <> | Date | Sat, 18 Apr 2020 15:23:54 +0800 |
| |
Hi Corey:
On 2020/4/18 10:14, Corey Minyard wrote: > Sorry for the delay, I have had a lot of distractions.
No no no, it's greatly appreciated for your instruction. Thanks.
> > The trouble is that the handling of bt_bmc->irq needs to be consistent. > Either it needs to be negative if the irq allocation fails, or it needs > to be zero if the irq allocation fails. I think it needs to be negative > because zero is a valid interrupt in some cases. > > Consider the following code: > > bt_bmc_config_irq(bt_bmc, pdev); > > if (bt_bmc->irq) { > dev_info(dev, "Using IRQ %d\n", bt_bmc->irq); > } else { > dev_info(dev, "No IRQ; using timer\n"); > timer_setup(&bt_bmc->poll_timer, poll_timer, 0); > > If bt_bmc->irq is negative (if platform_get_irq_optional() fails), it > will say it's using the irq and won't start a timer and the driver won't > work. Then later (in your change below) it will try to stop the timer > even though it's not running. > > If devm_request_irq() fails, then the interrupt is not set, but since > bt_bmc->irq is most likely not zero, it will not start the timer and the > driver won't work. > > You really need to set bt_bmc->irq negative if it fails. And fix the > check above to be if (bt_bmc->irq >= 0).
Got it. You are right, I am lacking in consideration here.
Thank you very much, I will send the v2.
Tang Bin
> > >
| |