Date: Thu, 20 Apr 2023 10:42:40 +0200 * Use two values for computations (in one if branch) without storing them in intermediate variables. * Remove the local variables “last_evm” and “tmpVal” which became unnecessary with this refactoring. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/staging/rtl8712/rtl8712_recv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index f0789b5ef59b..3a72d0601dc0 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -862,7 +862,6 @@ static void query_rx_phy_status(struct _adapter *padapter, static void process_link_qual(struct _adapter *padapter, union recv_frame *prframe) { - u32 last_evm = 0, tmpVal; struct rx_pkt_attrib *pattrib; struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data; @@ -873,8 +872,7 @@ static void process_link_qual(struct _adapter *padapter, */ if (sqd->total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX) { sqd->total_num = PHY_LINKQUALITY_SLID_WIN_MAX; - last_evm = sqd->elements[sqd->index]; - sqd->total_val -= last_evm; + sqd->total_val -= sqd->elements[sqd->index]; } sqd->total_val += pattrib->signal_qual; sqd->elements[sqd->index++] = pattrib->signal_qual; @@ -882,8 +880,8 @@ static void process_link_qual(struct _adapter *padapter, sqd->index = 0; /* <1> Showed on UI for user, in percentage. */ - tmpVal = sqd->total_val / sqd->total_num; - padapter->recvpriv.signal = (u8)tmpVal; + padapter->recvpriv.signal = (u8)(sqd->total_val + / sqd->total_num); } } -- 2.40.0