[PATCH] virtio_net: Use max() function for better coding conventions
From: Yang Rong
Date: Sun Jul 09 2023 - 21:28:00 EST
It is advisable to utilize the max() function in the virtio_net.c file,
as it conforms better to programming conventions.
Signed-off-by: Yang Rong <yangrong@xxxxxxxx>
---
drivers/net/virtio_net.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
mode change 100644 => 100755 drivers/net/virtio_net.c
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9b3721424e71..5bb7da885f00
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -22,6 +22,7 @@
#include <net/route.h>
#include <net/xdp.h>
#include <net/net_failover.h>
+#include <linux/minmax.h>
static int napi_weight = NAPI_POLL_WEIGHT;
module_param(napi_weight, int, 0444);
@@ -1291,7 +1292,7 @@ static struct sk_buff *build_skb_from_xdp_buff(struct net_device *dev,
__skb_put(skb, data_len);
metasize = xdp->data - xdp->data_meta;
- metasize = metasize > 0 ? metasize : 0;
+ metasize = max(metasize, 0);
if (metasize)
skb_metadata_set(skb, metasize);
--
2.35.3