Re: [PATCH v2] ipmi:bt-bmc: Fix error handling and status check
From: Tang Bin
Date: Sun Apr 19 2020 - 02:28:24 EST
Hi, Corey:
On 2020/4/18 21:49, Corey Minyard wrote:
On Sat, Apr 18, 2020 at 04:02:29PM +0800, Tang Bin wrote:
If the function platform_get_irq() failed, the negative
value returned will not be detected here. So fix error
handling in bt_bmc_config_irq(). And if devm_request_irq()
failed, 'bt_bmc->irq' is assigned to zero maybe redundant,
it may be more suitable for using the correct negative values
to make the status check in the function bt_bmc_remove().
You need to mention changing platform_get_irq to
platform_get_irq_optional in the header.
Another comment inline below.
Otherwise, this looks good.
Got it. The v3 will be as followsï
If the function platform_get_irq() failed, the negative value
returned will not be detected here. So fix error handling in
bt_bmc_config_irq(). And in the function bt_bmc_probe(),
when get irq failed, it will print error message. So use
platform_get_irq_optional() to simplify code. Finally in the
function bt_bmc_remove() should make the right status
check if get irq failed.
You need to set this to rc. Otherwise it will remain the interrupt
number assigned by platform_get_irq_optional().
Yes, I think you are right. I'm not as considerate as you. Thank you for
your instruction.
When get irq failed, the 'bt_bmc->irq' is negative; when request irq
failed, the 'bt_bmc->irq = 0' is right.
So 'bt_bmc->irq <= 0' means irq failed.
Now let me rearrange the logic here:
ÂÂÂ In bt_bmc_probe():
ÂÂÂ ÂÂÂ bt_bmc_config_irq(bt_bmc, pdev);
ÂÂ ÂÂ Â if (bt_bmc->irq > 0) {
ÂÂÂ ÂÂÂ }
ÂÂÂ In bt_bmc_remove():
ÂÂÂ ÂÂÂ if (bt_bmc->irq <= 0)
ÂÂÂ ÂÂÂ ÂÂÂ del_timer_sync(&bt_bmc->poll_timer);
If you think this logic is correct, I'll submit v3.
Thanks,
Tang Bin