Skip to content

Commit bd4051e

Browse files
alfonderkelvin-cao
authored andcommitted
ntb_hw_switchtec: Fix ntb_mw_clear_trans error if size == 0
ntb_mw_set_trans() should work as ntb_mw_clear_trans() when size == 0 and/or addr == 0. But error in xlate_pos checking condition prevents this. Fix the condition to make ntb_mw_clear_trans() working. Fixes: 87d11e645e31 (NTB: switchtec_ntb: Add memory window support) Signed-off-by: Alexander Fomichev <[email protected]> Reviewed-by: Logan Gunthorpe <[email protected]> Signed-off-by: Jon Mason <[email protected]>
1 parent 50cd102 commit bd4051e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ntb_hw_switchtec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
322322
if (widx >= switchtec_ntb_mw_count(ntb, pidx))
323323
return -EINVAL;
324324

325-
if (xlate_pos < 12)
325+
if (size != 0 && xlate_pos < 12)
326326
return -EINVAL;
327327

328328
if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {

0 commit comments

Comments
 (0)