From nobody Wed Dec 17 11:45:48 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 B7C50C77B72 for ; Thu, 20 Apr 2023 09:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234357AbjDTJfx (ORCPT ); Thu, 20 Apr 2023 05:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbjDTJff (ORCPT ); Thu, 20 Apr 2023 05:35:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E42FC for ; Thu, 20 Apr 2023 02:35:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DEB9612BF for ; Thu, 20 Apr 2023 09:35:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC9DAC433D2; Thu, 20 Apr 2023 09:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681983333; bh=HdXdYZQym10kC00W6v8aqZexsVRWoeV8afyKO+dOT+A=; h=From:To:Cc:Subject:Date:From; b=shh3XgWtjmfw19L2I93GmoLp8nqi24i/kDwt76X0fh5Si7fetgh5XTk3cNt2r+jC2 nyMIKL6DLKe/kzAA+YRrN4Vj63Zk4ZobAgc3DSwqW79nru26z6p6Q6fBKQZ06L30Z4 bYB0ZSBpU1sUgbnjXZVNvUz3l2283aFA0OaLyImc3BpHtj38HPOLgRl42DWHjBxnQD ku4htZPvO0Op871FJsHDNxrMoZsKAioMzH5wgXfCGlSVCra53pgiysgh6yxfkFGNkz UwyM7rK1jGfJNe09a0KE8EAeFOgHNy0syqNGSY1V868lXD1Zb+Vnn6qbs8iXXMH7Pp piVDNYiob5M8g== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH] tty: synclink_gt: don't allocate and pass dummy flags Date: Thu, 20 Apr 2023 11:35:30 +0200 Message-Id: <20230420093530.13133-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.40.0 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" In synclinc_gt, the flag_buf is allocated, zeroed and passed to ldisc's receive_buf(). It is never written to, so it serves as a dummy buffer. That's unneeded because all ldiscs accept NULL as flags. That NULL resolves to the TTY_NORMAL flag. So drop all this nonsense. Signed-off-by: Jiri Slaby (SUSE) --- drivers/tty/synclink_gt.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 543b3224dce9..16e469e581ec 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -287,7 +287,6 @@ struct slgt_info { unsigned char *tx_buf; int tx_count; =20 - char *flag_buf; bool drop_rts_on_tx_done; struct _input_signal_events input_signal_events; =20 @@ -3244,13 +3243,7 @@ static int alloc_tmp_rbuf(struct slgt_info *info) info->tmp_rbuf =3D kmalloc(info->max_frame_size + 5, GFP_KERNEL); if (info->tmp_rbuf =3D=3D NULL) return -ENOMEM; - /* unused flag buffer to satisfy receive_buf calling interface */ - info->flag_buf =3D kzalloc(info->max_frame_size + 5, GFP_KERNEL); - if (!info->flag_buf) { - kfree(info->tmp_rbuf); - info->tmp_rbuf =3D NULL; - return -ENOMEM; - } + return 0; } =20 @@ -3258,8 +3251,6 @@ static void free_tmp_rbuf(struct slgt_info *info) { kfree(info->tmp_rbuf); info->tmp_rbuf =3D NULL; - kfree(info->flag_buf); - info->flag_buf =3D NULL; } =20 /* @@ -4657,7 +4648,8 @@ static bool rx_get_frame(struct slgt_info *info) hdlcdev_rx(info,info->tmp_rbuf, framesize); else #endif - ldisc_receive_buf(tty, info->tmp_rbuf, info->flag_buf, framesize); + ldisc_receive_buf(tty, info->tmp_rbuf, NULL, + framesize); } } free_rbufs(info, start, end); @@ -4691,8 +4683,8 @@ static bool rx_get_buf(struct slgt_info *info) DBGDATA(info, info->rbufs[i].buf, count, "rx"); DBGINFO(("rx_get_buf size=3D%d\n", count)); if (count) - ldisc_receive_buf(info->port.tty, info->rbufs[i].buf, - info->flag_buf, count); + ldisc_receive_buf(info->port.tty, info->rbufs[i].buf, NULL, + count); free_rbufs(info, i, i); return true; } --=20 2.40.0