From: Tong Zhang <ztong0001@gmail.com>
To: jikos@kernel.org, dsterba@suse.com, gregkh@linuxfoundation.org,
jirislaby@kernel.org, ztong0001@gmail.com,
linux-kernel@vger.kernel.org
Subject: [PATCH v3] tty: ipwireless: fix error handling
Date: Fri, 21 Aug 2020 12:19:40 -0400 [thread overview]
Message-ID: <20200821161942.36589-1-ztong0001@gmail.com> (raw)
In-Reply-To: <20200821092844.GB2026@suse.cz>
ipwireless_send_packet() can only return 0 on success and -ENOMEM on
error, the caller should check non zero for error condition
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
---
v2: - According to Jiri's comment, I made the checking consistent with
the rest of the kernel. I also rebased the code using f684668a24ec.
Thank you Jiri!
v3: fix commit log according to David's comment, and rebased using
Greg's tty-testing tree. Thank you David!
drivers/tty/ipwireless/network.c | 4 ++--
drivers/tty/ipwireless/tty.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c
index cf20616340a1..fe569f6294a2 100644
--- a/drivers/tty/ipwireless/network.c
+++ b/drivers/tty/ipwireless/network.c
@@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
skb->len,
notify_packet_sent,
network);
- if (ret == -1) {
+ if (ret < 0) {
skb_pull(skb, 2);
return 0;
}
@@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
notify_packet_sent,
network);
kfree(buf);
- if (ret == -1)
+ if (ret < 0)
return 0;
}
kfree_skb(skb);
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index fad3401e604d..23584769fc29 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty,
ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
buf, count,
ipw_write_packet_sent_callback, tty);
- if (ret == -1) {
+ if (ret < 0) {
mutex_unlock(&tty->ipw_tty_mutex);
return 0;
}
--
2.25.1
next prev parent reply other threads:[~2020-08-21 16:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-16 7:43 [PATCH] tty: ipwireless: fix error handling Tong Zhang
2020-08-18 8:35 ` Jiri Slaby
2020-08-18 16:03 ` [PATCH v2] " Tong Zhang
2020-08-21 9:28 ` David Sterba
2020-08-21 16:19 ` Tong Zhang [this message]
2020-08-21 16:20 ` Tong Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200821161942.36589-1-ztong0001@gmail.com \
--to=ztong0001@gmail.com \
--cc=dsterba@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=jikos@kernel.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.