From nobody Fri Dec 19 07:31:05 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E43BAC54FB9 for ; Tue, 21 Nov 2023 09:24:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233201AbjKUJY1 (ORCPT ); Tue, 21 Nov 2023 04:24:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbjKUJXx (ORCPT ); Tue, 21 Nov 2023 04:23:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67EE11723 for ; Tue, 21 Nov 2023 01:23:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4831DC433AD; Tue, 21 Nov 2023 09:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700558614; bh=jNbLNG352qLl5DsDvu9XIk5DhjEuWNeT8bITasbQfSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTApM2Yz3k5LHdAR4SR/rf/9Gl3mNc2Hvoyj2G8mZC5bTs6jO4B3AkehK6TERw/jE dDjyGKGTipA9BQhnJhEIGUb0+kIsTZIqdO4/YRRp7wqpBIBDT5nWmRyR06iLZtUSKj PDOnO6UOlVtXDmLVy3viFS3QM/97XIKizEL4wNWTLXpSBHU210Fpd8OAWEevVUsKLa xNthtXLGxffbib6PvfmVJ7prxCG1fHdQum+Nr6EtOd8/OGKIQK7sNrbXQFbHPG8xMx jwpECnt8xBCUm7KzirZOLUZKz9cVMN3Nr74msXOp1g5ULl3Ld8u5Vwn+QpaT1wLqc6 OHWaHpuGEE9Xg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Richard Henderson , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org Subject: [PATCH 16/17] tty: srmcons: switch need_cr to bool Date: Tue, 21 Nov 2023 10:22:57 +0100 Message-ID: <20231121092258.9334-17-jirislaby@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231121092258.9334-1-jirislaby@kernel.org> References: <20231121092258.9334-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 'need_cr' is a flag, so type it properly to be a 'bool'. Move the declaration into the loop too. That ensures the variable is initialized properly even if the code was moved somehow. Signed-off-by: Jiri Slaby (SUSE) Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: linux-alpha@vger.kernel.org Reviewed-by: Richard Henderson --- arch/alpha/kernel/srmcons.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index 32bc098de7da..c6b821afbfd3 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -94,17 +94,16 @@ srmcons_do_write(struct tty_port *port, const char *buf= , int count) static char str_cr[1] =3D "\r"; size_t c; srmcons_result result; - int need_cr; =20 while (count > 0) { - need_cr =3D 0; + bool need_cr =3D false; /*=20 * Break it up into reasonable size chunks to allow a chance * for input to get in */ for (c =3D 0; c < min_t(size_t, 128U, count) && !need_cr; c++) if (buf[c] =3D=3D '\n') - need_cr =3D 1; + need_cr =3D true; =09 while (c > 0) { result.as_long =3D callback_puts(0, buf, c); @@ -122,7 +121,7 @@ srmcons_do_write(struct tty_port *port, const char *buf= , int count) while (need_cr) { result.as_long =3D callback_puts(0, str_cr, 1); if (result.bits.c > 0) - need_cr =3D 0; + need_cr =3D false; } } } --=20 2.42.1