linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Haowen Bai <baihaowen88@gmail.com>,
	sebastian.hesselbarth@gmail.com, davem@davemloft.net,
	kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: marvell: Use min() instead of doing it manually
Date: Tue, 1 Mar 2022 08:33:39 +0100	[thread overview]
Message-ID: <ff76734b-fb2f-cc9d-cd05-5256efb6cde0@gmail.com> (raw)
In-Reply-To: <1646115417-24639-1-git-send-email-baihaowen88@gmail.com>

On 01.03.2022 07:16, Haowen Bai wrote:
> Fix following coccicheck warning:
> drivers/net/ethernet/marvell/mv643xx_eth.c:1664:35-36: WARNING opportunity for min()
> 
> Signed-off-by: Haowen Bai <baihaowen88@gmail.com>
> ---
>  drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index 143ca8b..1018b9e 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -1661,7 +1661,7 @@ mv643xx_eth_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er,
>  	if (er->rx_mini_pending || er->rx_jumbo_pending)
>  		return -EINVAL;
>  
> -	mp->rx_ring_size = er->rx_pending < 4096 ? er->rx_pending : 4096;
> +	mp->rx_ring_size = min(er->rx_pending, 4096);

Did you test this? Supposedly it won't compile cleanly due to the
min macro type checking (rx_pending is __u32, 4096 is int).

>  	mp->tx_ring_size = clamp_t(unsigned int, er->tx_pending,
>  				   MV643XX_MAX_SKB_DESCS * 2, 4096);
>  	if (mp->tx_ring_size != er->tx_pending)


  reply	other threads:[~2022-03-01  7:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  6:16 [PATCH] net: marvell: Use min() instead of doing it manually Haowen Bai
2022-03-01  7:33 ` Heiner Kallweit [this message]
2022-03-01 10:29 ` kernel test robot
2022-03-02  1:38   ` lotte bai

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=ff76734b-fb2f-cc9d-cd05-5256efb6cde0@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=baihaowen88@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.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).