From: bui duc phuc <[email protected]>

Only call devm_request_irq() when a valid positive IRQ number is
available.

Remove the redundant warning since devm_request_irq() already reports
the error. There is also no need to store the error in bt_bmc->irq,
as errors other than -ENXIO are returned to the caller instead of
being handled as the no-IRQ case.

Signed-off-by: bui duc phuc <[email protected]>
---
 drivers/char/ipmi/bt-bmc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/char/ipmi/bt-bmc.c b/drivers/char/ipmi/bt-bmc.c
index 4c5457c88503..99b38300f9e1 100644
--- a/drivers/char/ipmi/bt-bmc.c
+++ b/drivers/char/ipmi/bt-bmc.c
@@ -383,12 +383,11 @@ static int bt_bmc_config_irq(struct bt_bmc *bt_bmc,
        if (bt_bmc->irq < 0 && bt_bmc->irq != -ENXIO)
                return bt_bmc->irq;
 
-       rc = devm_request_irq(dev, bt_bmc->irq, bt_bmc_irq, IRQF_SHARED,
-                             DEVICE_NAME, bt_bmc);
-       if (rc < 0) {
-               dev_warn(dev, "Unable to request IRQ %d\n", bt_bmc->irq);
-               bt_bmc->irq = rc;
-               return rc;
+       if (bt_bmc->irq > 0) {
+               rc = devm_request_irq(dev, bt_bmc->irq, bt_bmc_irq,
+                                     IRQF_SHARED, DEVICE_NAME, bt_bmc);
+               if (rc < 0)
+                       return rc;
        }
 
        /*
-- 
2.43.0



_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to