Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ntb_hw_switchtec: fix logic error

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")
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jon Mason <jdmason@kudzu.us>

authored by

Arnd Bergmann and committed by
Jon Mason
c6fad21a 1e2fd202

+1 -1
+1 -1
drivers/ntb/hw/mscc/ntb_hw_switchtec.c
··· 898 898 } 899 899 900 900 sndev->peer_partition = ffs(tpart_vec) - 1; 901 - if (!(part_map && (1 << sndev->peer_partition))) { 901 + if (!(part_map & (1 << sndev->peer_partition))) { 902 902 dev_err(&sndev->stdev->dev, 903 903 "ntb target partition is not NT partition\n"); 904 904 return -ENODEV;