summary refs log tree commit diff
path: root/net/caif/cfrfml.c
diff options
context:
space:
mode:
authorTong Zhang <ztong0001@gmail.com>2020-08-24 18:08:06 -0400
committerDavid S. Miller <davem@davemloft.net>2020-08-25 07:50:25 -0700
commite104684108fc8b846dbca889f28257a65a956874 (patch)
tree85e6a849f2e332f669309b48ba1b141f10535231 /net/caif/cfrfml.c
parent8e4efd4706f77d76c99f78f8859e1d61fae5142a (diff)
downloadlinux-e104684108fc8b846dbca889f28257a65a956874.tar.gz
net: caif: fix error code handling
cfpkt_peek_head return 0 and 1, caller is checking error using <0

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/cfrfml.c')
-rw-r--r--net/caif/cfrfml.c4
1 files changed, 2 insertions, 2 deletions
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) {