Skip to content

Commit b44ac98

Browse files
committed
NTB: ntb_transport: Fix off-by-one on doorbells count
ilog2() returns zero when there is only one doorbell, that made qp_count zero and failed any client attachment. Use of fls64() instead fixes this off-by-one error. Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
1 parent 7f5e1a1 commit b44ac98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ntb/ntb_transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
14351435

14361436
qp_bitmap = ntb_db_valid_mask(ndev);
14371437

1438-
qp_count = ilog2(qp_bitmap);
1438+
qp_count = fls64(qp_bitmap);
14391439
if (nt->use_msi) {
14401440
qp_count -= 1;
14411441
nt->msi_db_mask = BIT_ULL(qp_count);

0 commit comments

Comments
 (0)