netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Zhengchao Shao'" <shaozhengchao@huawei.com>,
	<netdev@vger.kernel.org>, <mengyuanlou@net-swift.com>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>
Cc: <weiyongjun1@huawei.com>, <yuehaibing@huawei.com>
Subject: RE: [PATCH net-next] net: txgbe: remove unused buffer in txgbe_calc_eeprom_checksum
Date: Mon, 19 Jun 2023 18:10:47 +0800	[thread overview]
Message-ID: <005c01d9a296$513915b0$f3ab4110$@trustnetic.com> (raw)
In-Reply-To: <20230619085709.104271-1-shaozhengchao@huawei.com>

On Monday, June 19, 2023 4:57 PM, Zhengchao Shao wrote:
> Half a year passed since commit 049fe5365324c ("net: txgbe: Add operations
> to interact with firmware") was submitted, the buffer in
> txgbe_calc_eeprom_checksum was not used. So remove it and the related
> branch codes.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>  drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c | 31 +++++++------------
>  1 file changed, 11 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
> index ebc46f3be056..173437c7a55f 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
> @@ -161,33 +161,24 @@ static int txgbe_calc_eeprom_checksum(struct wx *wx, u16 *checksum)
>  {
>  	u16 *eeprom_ptrs = NULL;
>  	u32 buffer_size = 0;
> -	u16 *buffer = NULL;
>  	u16 *local_buffer;
>  	int status;
>  	u16 i;
> 
>  	wx_init_eeprom_params(wx);
> 
> -	if (!buffer) {
> -		eeprom_ptrs = kvmalloc_array(TXGBE_EEPROM_LAST_WORD, sizeof(u16),
> -					     GFP_KERNEL);
> -		if (!eeprom_ptrs)
> -			return -ENOMEM;
> -		/* Read pointer area */
> -		status = wx_read_ee_hostif_buffer(wx, 0,
> -						  TXGBE_EEPROM_LAST_WORD,
> -						  eeprom_ptrs);
> -		if (status != 0) {
> -			wx_err(wx, "Failed to read EEPROM image\n");
> -			kvfree(eeprom_ptrs);
> -			return status;
> -		}
> -		local_buffer = eeprom_ptrs;
> -	} else {
> -		if (buffer_size < TXGBE_EEPROM_LAST_WORD)
> -			return -EFAULT;
> -		local_buffer = buffer;
> +	eeprom_ptrs = kvmalloc_array(TXGBE_EEPROM_LAST_WORD, sizeof(u16),
> +				     GFP_KERNEL);
> +	if (!eeprom_ptrs)
> +		return -ENOMEM;
> +	/* Read pointer area */
> +	status = wx_read_ee_hostif_buffer(wx, 0, TXGBE_EEPROM_LAST_WORD, eeprom_ptrs);
> +	if (status != 0) {
> +		wx_err(wx, "Failed to read EEPROM image\n");
> +		kvfree(eeprom_ptrs);
> +		return status;
>  	}
> +	local_buffer = eeprom_ptrs;
> 
>  	for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++)
>  		if (i != wx->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM)
> --
> 2.34.1
> 

Reviewed-by: Jiawen Wu <jiawenwu@trustnetic.com>


  reply	other threads:[~2023-06-19 10:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19  8:57 [PATCH net-next] net: txgbe: remove unused buffer in txgbe_calc_eeprom_checksum Zhengchao Shao
2023-06-19 10:10 ` Jiawen Wu [this message]
2023-06-19 18:54 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='005c01d9a296$513915b0$f3ab4110$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaozhengchao@huawei.com \
    --cc=weiyongjun1@huawei.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).