* [PATCH] IB/hfi1: Fix logical condition in msix_request_irq
@ 2020-01-16 22:26 Nathan Chancellor
2020-01-16 22:43 ` Nick Desaulniers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Nathan Chancellor @ 2020-01-16 22:26 UTC (permalink / raw)
To: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford, Jason Gunthorpe
Cc: linux-rdma, linux-kernel, clang-built-linux, 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.
Link: https://github.com/ClangBuiltLinux/linux/issues/841
Fixes: 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/infiniband/hw/hfi1/msix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hfi1/msix.c b/drivers/infiniband/hw/hfi1/msix.c
index 4a620cf80588..db82db497b2c 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);
--
2.25.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IB/hfi1: Fix logical condition in msix_request_irq
2020-01-16 22:26 [PATCH] IB/hfi1: Fix logical condition in msix_request_irq Nathan Chancellor
@ 2020-01-16 22:43 ` Nick Desaulniers
2020-01-17 17:14 ` Dennis Dalessandro
2020-01-25 19:36 ` Jason
2 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2020-01-16 22:43 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford,
Jason Gunthorpe, linux-rdma, LKML, clang-built-linux
On Thu, Jan 16, 2020 at 2:27 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> 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://github.com/ClangBuiltLinux/linux/issues/841
> Fixes: 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Thanks for the patch. LGTM.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> drivers/infiniband/hw/hfi1/msix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/msix.c b/drivers/infiniband/hw/hfi1/msix.c
> index 4a620cf80588..db82db497b2c 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)
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] IB/hfi1: Fix logical condition in msix_request_irq
2020-01-16 22:26 [PATCH] IB/hfi1: Fix logical condition in msix_request_irq Nathan Chancellor
2020-01-16 22:43 ` Nick Desaulniers
@ 2020-01-17 17:14 ` Dennis Dalessandro
2020-01-25 19:36 ` Jason
2 siblings, 0 replies; 4+ messages in thread
From: Dennis Dalessandro @ 2020-01-17 17:14 UTC (permalink / raw)
To: Nathan Chancellor, Mike Marciniszyn, Doug Ledford, Jason Gunthorpe
Cc: linux-rdma, linux-kernel, clang-built-linux
On 1/16/2020 5:26 PM, Nathan Chancellor wrote:
> 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://github.com/ClangBuiltLinux/linux/issues/841
> Fixes: 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] IB/hfi1: Fix logical condition in msix_request_irq
2020-01-16 22:26 [PATCH] IB/hfi1: Fix logical condition in msix_request_irq Nathan Chancellor
2020-01-16 22:43 ` Nick Desaulniers
2020-01-17 17:14 ` Dennis Dalessandro
@ 2020-01-25 19:36 ` Jason
2 siblings, 0 replies; 4+ messages in thread
From: Jason @ 2020-01-25 19:36 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford,
Jason Gunthorpe, linux-rdma, linux-kernel, clang-built-linux
On Thu, Jan 16, 2020 at 03:26:58PM -0700, Nathan Chancellor wrote:
> 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://github.com/ClangBuiltLinux/linux/issues/841
> Fixes: 13d2a8384bd9 ("IB/hfi1: Decouple IRQ name from type")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> ---
> drivers/infiniband/hw/hfi1/msix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-25 19:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 22:26 [PATCH] IB/hfi1: Fix logical condition in msix_request_irq Nathan Chancellor
2020-01-16 22:43 ` Nick Desaulniers
2020-01-17 17:14 ` Dennis Dalessandro
2020-01-25 19:36 ` Jason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).