Re: [PATCH] staging: rtl8712: Remove unnecessary variable in rtl8712_recv.c

From: Greg KH
Date: Thu May 30 2019 - 17:16:25 EST


On Wed, May 29, 2019 at 06:50:31PM +0530, Nishka Dasgupta wrote:
> Remove unnecessary variable last_evm in rtl8712_recv.c and use its value
> directly.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@xxxxxxxxx>
> ---
> drivers/staging/rtl8712/rtl8712_recv.c | 5 ++---
> drivers/staging/rtl8712/rtl871x_cmd.c | 2 +-
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
> index 82ddc0c3ecd4..f6f7cd5fd0f2 100644
> --- a/drivers/staging/rtl8712/rtl8712_recv.c
> +++ b/drivers/staging/rtl8712/rtl8712_recv.c
> @@ -885,7 +885,7 @@ 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;
> + u32 tmpVal;
> struct rx_pkt_attrib *pattrib;
> struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
>
> @@ -898,8 +898,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];

Nope, original code is easier to understand :(

> }
> sqd->total_val += pattrib->signal_qual;
> sqd->elements[sqd->index++] = pattrib->signal_qual;
> diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
> index 05a78ac24987..7c437ee9e022 100644
> --- a/drivers/staging/rtl8712/rtl871x_cmd.c
> +++ b/drivers/staging/rtl8712/rtl871x_cmd.c
> @@ -880,7 +880,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
> }
> r8712_indicate_connect(padapter);
> } else {
> - pwlan = _r8712_alloc_network(pmlmepriv);
> + pwlan = r8712_alloc_network(pmlmepriv);

what does this change have to do with your changelog?

confused,

greg k-h