CC: [email protected] CC: [email protected] TO: Denis Efremov <[email protected]> CC: Julia Lawall <[email protected]> CC: Edward Cree <[email protected]> CC: Martin Habets <[email protected]> CC: Jakub Kicinski <[email protected]> CC: [email protected] CC: [email protected]
From: kernel test robot <[email protected]> drivers/net/ethernet/sfc/efx_channels.c:804:36-37: WARNING opportunity for swap() drivers/net/ethernet/sfc/efx_channels.c:850:36-37: WARNING opportunity for swap() Check for opencoded swap() implementation. Generated by: scripts/coccinelle/misc/swap.cocci CC: Denis Efremov <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: kernel test robot <[email protected]> --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 40226a3d96ef8ab8980f032681c8bfd46d63874e commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script :::::: branch date: 4 hours ago :::::: commit date: 2 months ago Please take the patch only if it's a positive warning. Thanks! efx_channels.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/sfc/efx_channels.c +++ b/drivers/net/ethernet/sfc/efx_channels.c @@ -799,11 +799,9 @@ int efx_realloc_channels(struct efx_nic 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; @@ -845,11 +843,9 @@ rollback: /* 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; } _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
