The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Yang Li <yang.lee@linux.alibaba.com>, davem@davemloft.net
Cc: kuba@kernel.org, andrew@lunn.ch, linux@armlinux.org.uk,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH -next] net: phy: micrel: use min() macro instead of doing it manually
Date: Fri, 24 Dec 2021 10:30:30 +0100	[thread overview]
Message-ID: <30be5b7d-3049-6bb9-9dc2-61b80fed10e0@gmail.com> (raw)
In-Reply-To: <20211224091208.32274-1-yang.lee@linux.alibaba.com>

On 24.12.2021 10:12, Yang Li wrote:
> Fix following coccicheck warning:
> ./drivers/net/phy/micrel.c:1482:12-13: WARNING opportunity for min()
> 
Please always check whether a coccicheck warning makes sense,
and don't create "fixes" mechanically w/o thinking.
Here using min() doesn't make sense because it's not about a
numerical operation. ret < 0 is equivalent to is_err(ret).


> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/net/phy/micrel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index c6a97fcca0e6..dda426596445 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1479,7 +1479,7 @@ static int ksz886x_cable_test_wait_for_completion(struct phy_device *phydev)
>  				    !(val & KSZ8081_LMD_ENABLE_TEST),
>  				    30000, 100000, true);
>  
> -	return ret < 0 ? ret : 0;
> +	return min(ret, 0);
>  }
>  
>  static int ksz886x_cable_test_one_pair(struct phy_device *phydev, int pair)


      reply	other threads:[~2021-12-24  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-24  9:12 [PATCH -next] net: phy: micrel: use min() macro instead of doing it manually Yang Li
2021-12-24  9:30 ` Heiner Kallweit [this message]

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=30be5b7d-3049-6bb9-9dc2-61b80fed10e0@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=abaci@linux.alibaba.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=yang.lee@linux.alibaba.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