netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] asix: Use min() instead of doing it manually
@ 2021-12-25 17:08 Jiapeng Chong
  2021-12-26 17:18 ` Heiner Kallweit
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-12-25 17:08 UTC (permalink / raw)
  To: davem; +Cc: kuba, linux-usb, netdev, linux-kernel, Jiapeng Chong, Abaci Robot

Fix following coccicheck warning:

./drivers/net/usb/asix_common.c:545:12-13: WARNING opportunity for
min().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/net/usb/asix_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 71682970be58..da5a7df312d2 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -542,7 +542,7 @@ static int __asix_mdio_write(struct net_device *netdev, int phy_id, int loc,
 out:
 	mutex_unlock(&dev->phy_mutex);
 
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 
 void asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] asix: Use min() instead of doing it manually
  2021-12-25 17:08 [PATCH] asix: Use min() instead of doing it manually Jiapeng Chong
@ 2021-12-26 17:18 ` Heiner Kallweit
  0 siblings, 0 replies; 2+ messages in thread
From: Heiner Kallweit @ 2021-12-26 17:18 UTC (permalink / raw)
  To: Jiapeng Chong, davem; +Cc: kuba, linux-usb, netdev, linux-kernel, Abaci Robot

On 25.12.2021 18:08, Jiapeng Chong wrote:
> Fix following coccicheck warning:
> 
> ./drivers/net/usb/asix_common.c:545:12-13: WARNING opportunity for
> min().
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/net/usb/asix_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index 71682970be58..da5a7df312d2 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -542,7 +542,7 @@ static int __asix_mdio_write(struct net_device *netdev, int phy_id, int loc,
>  out:
>  	mutex_unlock(&dev->phy_mutex);
>  
> -	return ret < 0 ? ret : 0;
> +	return min(ret, 0);

Same comment as for a previous such patch. It doesn't make sense.
Also coccicheck isn't always right, please check whether a warning
is justified before sending a "fix".


>  }
>  
>  void asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-26 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-25 17:08 [PATCH] asix: Use min() instead of doing it manually Jiapeng Chong
2021-12-26 17:18 ` Heiner Kallweit

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).