public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-kernel@vger.kernel.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Gregory CLEMENT <gregory.clement@bootlin.com>
Subject: [PATCH 2/2] tty: n_gsm: Fix bogus i++ in gsm_data_kick
Date: Mon, 18 May 2020 10:45:13 +0200	[thread overview]
Message-ID: <20200518084517.2173242-3-gregory.clement@bootlin.com> (raw)
In-Reply-To: <20200518084517.2173242-1-gregory.clement@bootlin.com>

When submitting the previous fix "tty: n_gsm: Fix waking up upper tty
layer when room available". It was suggested to switch from a while to
a for loop, but when doing it, there was a remaining bogus i++.

This patch removes this i++ and also reorganizes the code making it more
compact.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 drivers/tty/n_gsm.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 4465dd04fead..0a29a94ec438 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -700,17 +700,9 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
 		} else {
 			int i = 0;
 
-			for (i = 0; i < NUM_DLCI; i++) {
-				struct gsm_dlci *dlci;
-
-				dlci = gsm->dlci[i];
-				if (dlci == NULL) {
-					i++;
-					continue;
-				}
-
-				tty_port_tty_wakeup(&dlci->port);
-			}
+			for (i = 0; i < NUM_DLCI; i++)
+				if (gsm->dlci[i])
+					tty_port_tty_wakeup(&gsm->dlci[i]->port);
 		}
 	}
 }
-- 
2.26.2


  parent reply	other threads:[~2020-05-18  8:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18  8:45 [PATCH 0/2] TTY fix-ups for "TTY improve n_gsm support" series Gregory CLEMENT
2020-05-18  8:45 ` [PATCH 1/2] tty: n_gsm: Remove unnecessary test in gsm_print_packet() Gregory CLEMENT
2020-05-18  8:45 ` Gregory CLEMENT [this message]
2020-05-18  8:45 ` [PATCH v2 0/3] TTY improve n_gsm support Gregory CLEMENT
2020-05-18 10:01   ` Gregory CLEMENT
2020-05-18  8:45 ` [PATCH v2 1/3] tty: n_gsm: Improve debug output Gregory CLEMENT
2020-05-18  8:45 ` [PATCH v2 2/3] tty: n_gsm: Fix SOF skipping Gregory CLEMENT
2020-05-18  8:45 ` [PATCH v2 3/3] tty: n_gsm: Fix waking up upper tty layer when room available Gregory CLEMENT

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=20200518084517.2173242-3-gregory.clement@bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox