[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220106090221.4gj6cevh2sb7hrfb@gmail.com>
Date: Thu, 6 Jan 2022 09:02:21 +0000
From: Martin Habets <habetsm.xilinx@...il.com>
To: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Cc: ecree.xilinx@...il.com, davem@...emloft.net, kuba@...nel.org,
ast@...nel.org, daniel@...earbox.net, hawk@...nel.org,
john.fastabend@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
Abaci Robot <abaci@...ux.alibaba.com>
Subject: Re: [PATCH] sfc: Use swap() instead of open coding it
On Wed, Jan 05, 2022 at 11:22:37PM +0800, Jiapeng Chong wrote:
> Clean the following coccicheck warning:
>
> ./drivers/net/ethernet/sfc/efx_channels.c:870:36-37: WARNING opportunity
> for swap().
>
> ./drivers/net/ethernet/sfc/efx_channels.c:824:36-37: WARNING opportunity
> for swap().
>
> Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Acked-by: Martin Habets <habetsm.xilinx@...il.com>
> ---
> drivers/net/ethernet/sfc/efx_channels.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
> index b015d1f2e204..ead550ae2709 100644
> --- a/drivers/net/ethernet/sfc/efx_channels.c
> +++ b/drivers/net/ethernet/sfc/efx_channels.c
> @@ -819,11 +819,8 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
> old_txq_entries = efx->txq_entries;
> efx->rxq_entries = rxq_entries;
> efx->txq_entries = txq_entries;
> - for (i = 0; i < efx->n_channels; i++) {
> - channel = efx->channel[i];
> - efx->channel[i] = other_channel[i];
> - other_channel[i] = channel;
> - }
> + for (i = 0; i < efx->n_channels; i++)
> + swap(efx->channel[i], other_channel[i]);
>
> /* Restart buffer table allocation */
> efx->next_buffer_table = next_buffer_table;
> @@ -865,11 +862,8 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
> /* Swap back */
> efx->rxq_entries = old_rxq_entries;
> efx->txq_entries = old_txq_entries;
> - for (i = 0; i < efx->n_channels; i++) {
> - channel = efx->channel[i];
> - efx->channel[i] = other_channel[i];
> - other_channel[i] = channel;
> - }
> + for (i = 0; i < efx->n_channels; i++)
> + swap(efx->channel[i], other_channel[i]);
> goto out;
> }
>
> --
> 2.20.1.7.g153144c
Powered by blists - more mailing lists