ntb_hw_switchtec: fix logic error
authorArnd Bergmann <arnd@arndb.de>
Tue, 16 Jan 2018 13:50:51 +0000 (14:50 +0100)
committerJon Mason <jdmason@kudzu.us>
Mon, 29 Jan 2018 03:17:23 +0000 (22:17 -0500)
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>
drivers/ntb/hw/mscc/ntb_hw_switchtec.c

index 6c6f991999b560b2d4baf677a7bde14128ac1c14..a1d547b6aa124de712d18bb327e46fb4595fd20c 100644 (file)
@@ -898,7 +898,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;