diff mbox series

net: caif: fix error code handling

Message ID 20200824220806.1257123-1-ztong0001@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series net: caif: fix error code handling | expand

Commit Message

Tong Zhang Aug. 24, 2020, 10:08 p.m. UTC
cfpkt_peek_head return 0 and 1, caller is checking error using <0

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
---
 net/caif/cfrfml.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Miller Aug. 25, 2020, 2:50 p.m. UTC | #1
From: Tong Zhang <ztong0001@gmail.com>
Date: Mon, 24 Aug 2020 18:08:06 -0400

> cfpkt_peek_head return 0 and 1, caller is checking error using <0
> 
> Signed-off-by: Tong Zhang <ztong0001@gmail.com>

Applied, thank you.
diff mbox series

Patch

diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c
index ce2767e9cec6..7b0af33bdb97 100644
--- a/net/caif/cfrfml.c
+++ b/net/caif/cfrfml.c
@@ -116,7 +116,7 @@  static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt)
 	if (segmented) {
 		if (rfml->incomplete_frm == NULL) {
 			/* Initial Segment */
-			if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0)
+			if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0)
 				goto out;
 
 			rfml->pdu_size = get_unaligned_le16(rfml->seghead+4);
@@ -233,7 +233,7 @@  static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
 	if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE)
 		err = cfpkt_peek_head(pkt, head, 6);
 
-	if (err < 0)
+	if (err != 0)
 		goto out;
 
 	while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {