From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 842F6C433E0 for ; Tue, 23 Jun 2020 20:54:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5546C20702 for ; Tue, 23 Jun 2020 20:54:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945651; bh=i1VysaGa42y0nHT5K3qxGsdgcH9ggzwrCWfHoQHl6ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NF93tpo2F3FxSV8I5CLngK/VF8notdivXfZKC4ndM75iz6XlKefn2zGnubf8ohnfG H9GnIz1j0mLLYbtYDFx3qxJhKDyoRI68epdds1jrBje8fo3DLs/2PQeDffS5ftawKS ASewb7/g2/YDrd3Euy/CyEMvVK31uFGVr2s+2GqQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392978AbgFWUyK (ORCPT ); Tue, 23 Jun 2020 16:54:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:43934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390111AbgFWUqH (ORCPT ); Tue, 23 Jun 2020 16:46:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 50FF12168B; Tue, 23 Jun 2020 20:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945167; bh=i1VysaGa42y0nHT5K3qxGsdgcH9ggzwrCWfHoQHl6ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d6MqxlBhjwP9VnCIpzyXn7BJ3cZuo5s6f8BZur0CeBHV57NCyEYMwJb36fER0PElN TyHUvv++KivhEy6/zxU7c3IFgq0Uqhdd0vzOr7i0RZGK0CReCugF4m0IsAyIge+iNZ f1Zv9rlKz1QhJEA+DrRLqw1rwx81EjzT0vj3vaSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.14 064/136] tty: n_gsm: Fix bogus i++ in gsm_data_kick Date: Tue, 23 Jun 2020 21:58:40 +0200 Message-Id: <20200623195306.911582028@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gregory CLEMENT [ Upstream commit 4dd31f1ffec6c370c3c2e0c605628bf5e16d5c46 ] 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 Link: https://lore.kernel.org/r/20200518084517.2173242-3-gregory.clement@bootlin.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 e7417eac3f216..c70e79a0e9f28 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -715,17 +715,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.25.1