[PATCH v1 05/17] j1939: socket: use min_t where possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/socket.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index be2d32452b64..68f1ccc44109 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -844,10 +844,8 @@ static int j1939_sk_send_multi(struct j1939_priv *priv,  struct sock *sk,
 	while (todo_size) {
 		struct j1939_sk_buff_cb *skcb;
 
-		if (todo_size > J1939_MAX_TP_PACKET_SIZE)
-			segment_size = J1939_MAX_TP_PACKET_SIZE;
-		else
-			segment_size = todo_size;
+		segment_size = min_t(size_t, J1939_MAX_TP_PACKET_SIZE,
+				     todo_size);
 
 		/* Allocate skb for one segment */
 		skb = j1939_sk_alloc_skb(priv->ndev, sk, msg, segment_size,
-- 
2.20.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux