Skip to contentSkip to conversation

IB/hfi1: Fix logical condition in msix_request_irq

PATCH Applied Nathan Chancellor 4 participants 4 messages Jan 16, 2020 – Jan 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/hfi1: Fix logical condition in msix_request_irq

Clang warns:

drivers/infiniband/hw/hfi1/msix.c:136:22: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]

        if (type < IRQ_SDMA && type >= IRQ_OTHER)
            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

1 warning generated.

It is impossible for something to be less than 0 (IRQ_SDMA) and greater than or equal to 3 (IRQ_OTHER) at the same time. A logical OR should have been used to keep the same logic as before.

Fixes 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")
---
 drivers/infiniband/hw/hfi1/msix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/msix.c +1 -1
index 4a620cf80588..db82db497b2c 100644
@@ -133,7 +133,7 @@ static int msix_request_irq(struct hfi1_devdata *dd, void *arg,
 	if (nr == dd->msix_info.max_requested)
 		return -ENOSPC;
 
-	if (type < IRQ_SDMA && type >= IRQ_OTHER)
+	if (type < IRQ_SDMA || type >= IRQ_OTHER)
 		return -EINVAL;
 
 	irq = pci_irq_vector(dd->pcidev, nr);
Signature · 1 line
2.25.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nathan Chancellor

Clang warns:

drivers/infiniband/hw/hfi1/msix.c:136:22: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]

        if (type < IRQ_SDMA && type >= IRQ_OTHER)
            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

1 warning generated.

Quoted 7 lines

It is impossible for something to be less than 0 (IRQ_SDMA) and greater than or equal to 3 (IRQ_OTHER) at the same time. A logical OR should have been used to keep the same logic as before.

Fixes 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")

Thanks for the patch. LGTM.

Quoted 14 lines
---
 drivers/infiniband/hw/hfi1/msix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/msix.c +1 -1
index 4a620cf80588..db82db497b2c 100644
@@ -133,7 +133,7 @@ static int msix_request_irq(struct hfi1_devdata *dd, void *arg,
        if (nr == dd->msix_info.max_requested)
                return -ENOSPC;
 
-       if (type < IRQ_SDMA && type >= IRQ_OTHER)
+       if (type < IRQ_SDMA || type >= IRQ_OTHER)
Signature · 2 lines
Thanks,
~Nick Desaulniers
Acked-by on v1 1/1
#2 lore raw
In reply to Nathan Chancellor
Quoted 8 lines · Nathan Chancellor

Clang warns:

drivers/infiniband/hw/hfi1/msix.c:136:22: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]

         if (type < IRQ_SDMA && type >= IRQ_OTHER)
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

1 warning generated.

Quoted 7 lines

It is impossible for something to be less than 0 (IRQ_SDMA) and greater than or equal to 3 (IRQ_OTHER) at the same time. A logical OR should have been used to keep the same logic as before.

Fixes 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")
Applied
#3 lore raw
In reply to Nathan Chancellor
Quoted 12 lines · Nathan Chancellor

Clang warns:

drivers/infiniband/hw/hfi1/msix.c:136:22: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]

        if (type < IRQ_SDMA && type >= IRQ_OTHER)
            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

1 warning generated.

It is impossible for something to be less than 0 (IRQ_SDMA) and greater than or equal to 3 (IRQ_OTHER) at the same time. A logical OR should have been used to keep the same logic as before.

Quoted 8 lines
---
 drivers/infiniband/hw/hfi1/msix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason