* [PATCH] ntb_hw_switchtec: fix logic error
@ 2017-12-06 14:19 Arnd Bergmann
2017-12-06 17:37 ` Logan Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-12-06 14:19 UTC (permalink / raw)
To: Kurt Schwemmer, Logan Gunthorpe, Jon Mason, Dave Jiang, Allen Hubbe
Cc: Arnd Bergmann, Stephen Bates, Colin Ian King, Doug Meyer,
Kelvin Cao, linux-pci, linux-ntb, linux-kernel
Newer gcc (version 7 and 8 presumably) warn about a statement mixing
the << operator with logical and:
drivers/ntb/hw/mscc/ntb_hw_switchtec.c: In function 'switchtec_ntb_init_sndev':
drivers/ntb/hw/mscc/ntb_hw_switchtec.c:888:24: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
My interpretation here is that the author must have intended a bitmask
rather than a comparison, so I'm changing the '&&' to '&', which makes
a lot more sense in the context.
Fixes: 1b249475275d ("ntb_hw_switchtec: Allow using Switchtec NTB in multi-partition setups")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
index bcd5b6fb3800..76acb8bba3f2 100644
--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
+++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
@@ -885,7 +885,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
}
sndev->peer_partition = ffs(tpart_vec) - 1;
- if (!(part_map && (1 << sndev->peer_partition))) {
+ if (!(part_map & (1 << sndev->peer_partition))) {
dev_err(&sndev->stdev->dev,
"ntb target partition is not NT partition\n");
return -ENODEV;
--
2.9.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ntb_hw_switchtec: fix logic error
2017-12-06 14:19 [PATCH] ntb_hw_switchtec: fix logic error Arnd Bergmann
@ 2017-12-06 17:37 ` Logan Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Logan Gunthorpe @ 2017-12-06 17:37 UTC (permalink / raw)
To: Arnd Bergmann, Kurt Schwemmer, Jon Mason, Dave Jiang, Allen Hubbe
Cc: Stephen Bates, Colin Ian King, Doug Meyer, Kelvin Cao, linux-pci,
linux-ntb, linux-kernel
Hey,
Thanks, nice catch.
On 06/12/17 07:19 AM, Arnd Bergmann wrote:
> Newer gcc (version 7 and 8 presumably) warn about a statement mixing
> the << operator with logical and:
>
> drivers/ntb/hw/mscc/ntb_hw_switchtec.c: In function 'switchtec_ntb_init_sndev':
> drivers/ntb/hw/mscc/ntb_hw_switchtec.c:888:24: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
>
> My interpretation here is that the author must have intended a bitmask
> rather than a comparison, so I'm changing the '&&' to '&', which makes
> a lot more sense in the context.
>
> Fixes: 1b249475275d ("ntb_hw_switchtec: Allow using Switchtec NTB in multi-partition setups")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Logan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-06 17:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 14:19 [PATCH] ntb_hw_switchtec: fix logic error Arnd Bergmann
2017-12-06 17:37 ` Logan Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®