ntb_hw_switchtec: Fix ntb_mw_clear_trans returning error if size == 0
Subsystems (3)
PATCH 1/1 ntb_hw_switchtec: Fix ntb_mw_clear_trans returning 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.
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
@@ -299,7 +299,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))) {
Signature · 1 line
2.17.1
Quoted 3 lines · Alexander Fomichev
ntb_mw_set_transshould work asntb_mw_clear_transwhen size == 0 and/or addr == 0. But error inxlate_poschecking condition prevents this. Fix the condition to makentb_mw_clear_transworking.
Nice catch, but you'll need to resubmit the patch with a Signed-off-by line. Please see [1].
When you do, you can also add:
Reviewed-by Logan Gunthorpe <[email protected]>
Thanks,
Logan
Quoted 18 lines
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1
-1@@ -299,7 +299,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))) {