From: Denis Bolotin Date: Mon, 12 Nov 2018 10:50:23 +0000 (+0200) Subject: qed: Fix reading wrong value in loop condition X-Git-Tag: v5.15~7561^2~27^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed4eac20dcffdad47709422e0cb925981b056668;p=platform%2Fkernel%2Flinux-starfive.git qed: Fix reading wrong value in loop condition The value of "sb_index" is written by the hardware. Reading its value and writing it to "index" must finish before checking the loop condition. Signed-off-by: Denis Bolotin Signed-off-by: Michal Kalderon Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c index 0f0aba7..b22f464 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_int.c +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c @@ -992,6 +992,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) */ do { index = p_sb_attn->sb_index; + /* finish reading index before the loop condition */ + dma_rmb(); attn_bits = le32_to_cpu(p_sb_attn->atten_bits); attn_acks = le32_to_cpu(p_sb_attn->atten_ack); } while (index != p_sb_attn->sb_index);