From: Nathan Chancellor Date: Thu, 16 Jan 2020 22:26:58 +0000 (-0700) Subject: IB/hfi1: Fix logical condition in msix_request_irq X-Git-Tag: v5.6-rc1~94^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79ba4f9310673a8870fda5a062a558923fa65c93;p=thirdparty%2Flinux.git 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. Link: https://lore.kernel.org/r/20200116222658.5285-1-natechancellor@gmail.com Link: https://github.com/ClangBuiltLinux/linux/issues/841 Fixes: 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type") Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Acked-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe --- diff --git a/drivers/infiniband/hw/hfi1/msix.c b/drivers/infiniband/hw/hfi1/msix.c index 4a620cf805889..db82db497b2cf 100644 --- a/drivers/infiniband/hw/hfi1/msix.c +++ b/drivers/infiniband/hw/hfi1/msix.c @@ -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);