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: 87d11e645e (NTB: switchtec_ntb: Add memory window support)
Signed-off-by: Alexander Fomichev <fomichev.ru@gmail.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
This commit is contained in:
Alexander Fomichev 2020-02-13 18:05:07 +03:00 committed by Jon Mason
parent 2ef97a6c18
commit 788b041afd
1 changed files with 1 additions and 1 deletions

View File

@ -285,7 +285,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
if (widx >= switchtec_ntb_mw_count(ntb, pidx))
return -EINVAL;
if (xlate_pos < 12)
if (size != 0 && xlate_pos < 12)
return -EINVAL;
if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {