Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2186633iof; Tue, 7 Jun 2022 22:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC4TYkKRVsI+hOWDpWPtKVD2dr4UiF9zboIO7E/CZR+dDrU2sQbrJvRb/9V9l9+ASKzLi5 X-Received: by 2002:a65:6e96:0:b0:3fd:c8b7:5fa6 with SMTP id bm22-20020a656e96000000b003fdc8b75fa6mr11252996pgb.569.1654666428113; Tue, 07 Jun 2022 22:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666428; cv=none; d=google.com; s=arc-20160816; b=jhCu7wim3d27dgfiSlwiPSvV0iVW/lLkl2AeSwqoc/EuLOxjm2lcem4F3nJYEKAMtW h5Mm+26Boakw2LWAmxN4qUcZbIdPup/oeB7JrOzYirXnLf05C1dmGYtBdQS62aJXvxkn /6O+TGKiBYjV8gIJaa/Czp7Ny7Te1vTV4NRX0xKSl9Jzp2EZWQbmG9hwbz9OIIhei6EQ S3ItUxMEFkxDcRh+Mx3zJh0aPknKmmdiADzzdlv+jlCK5HiPNq7oYAg8F31tnJwJWHLg ohlQ2Cm9e7JBRZH8KVnNEdwh3k2kVOPpeepHmyZIETQuPXCV+7raNU+qRV2b8UR/ku/C Tnrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XmNJQJmpLdzsryPE/PXl8UYkxm/HYtSK8EbA98b/REI=; b=DhtsoZzWbyUR4pdIy31WvUMKrDBIVv1aV3xReSED7gRmVocj0okjruWGp0Y/v8A1VZ LXv7EmS6Hu+ULJYlaYDlmosy6RJELG6qe0Q5ZbPjqcPEFr/ZfLRdob0KE9VmEIFGKVnQ uLnUBs+l2FSnq6j+/EBA4Af57h7UwU+MDM9MLBW23DBBylSsuiISAzb4rHqsalaWsMnG +F+GJZxl4K3cJGACM0GkBVEMSnFwG/OB8wiIwRiY6vydwTIP7369DmLpuslR+UwnBHEK mYs7Jv82bjC65Dgau9kNpcdoNN1W85ss2oyo2vLbTt8701Ixudf4qe/iQ/BE2LrbMacU L1fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wd5FZwfP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 189-20020a6301c6000000b003fca8eae72bsi22718317pgb.466.2022.06.07.22.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:33:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wd5FZwfP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 131634A0944; Tue, 7 Jun 2022 22:13:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389387AbiFHAfq (ORCPT + 99 others); Tue, 7 Jun 2022 20:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384755AbiFGWbM (ORCPT ); Tue, 7 Jun 2022 18:31:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E79527850D; Tue, 7 Jun 2022 12:24:26 -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 ams.source.kernel.org (Postfix) with ESMTPS id 76ADBB823CA; Tue, 7 Jun 2022 19:24:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C96A1C385A2; Tue, 7 Jun 2022 19:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629863; bh=/nt2azIDU63waHlYWHq5Z5MohAVPxSo0yJVmg3AdC48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wd5FZwfPbNWtO5tuZr+YbNztPwtFB41T8SVMCxqZfciK+hHWcuQ3ic0UP9SwOTBGM SKeCHVJKJ3H7wYQ666Srx6rc2JsQZrwnXk0OyXzA9Qbr6iQVPl0Sy45DK+VofpTWjz YPJKxotda+72OwcosKvxWOgmumAx4dqhjyA0tTEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby Subject: [PATCH 5.18 843/879] serial: pch: dont overwrite xmit->buf[0] by x_char Date: Tue, 7 Jun 2022 19:06:01 +0200 Message-Id: <20220607165027.320975559@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Slaby commit d9f3af4fbb1d955bbaf872d9e76502f6e3e803cb upstream. When x_char is to be sent, the TX path overwrites whatever is in the circular buffer at offset 0 with x_char and sends it using pch_uart_hal_write(). I don't understand how this was supposed to work if xmit->buf[0] already contained some character. It must have been lost. Remove this whole pop_tx_x() concept and do the work directly in the callers. (Without printing anything using dev_dbg().) Cc: Fixes: 3c6a483275f4 (Serial: EG20T: add PCH_UART driver) Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220503080808.28332-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -624,22 +624,6 @@ static int push_rx(struct eg20t_port *pr return 0; } -static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf) -{ - int ret = 0; - struct uart_port *port = &priv->port; - - if (port->x_char) { - dev_dbg(priv->port.dev, "%s:X character send %02x (%lu)\n", - __func__, port->x_char, jiffies); - buf[0] = port->x_char; - port->x_char = 0; - ret = 1; - } - - return ret; -} - static int dma_push_rx(struct eg20t_port *priv, int size) { int room; @@ -889,9 +873,10 @@ static unsigned int handle_tx(struct eg2 fifo_size = max(priv->fifo_size, 1); tx_empty = 1; - if (pop_tx_x(priv, xmit->buf)) { - pch_uart_hal_write(priv, xmit->buf, 1); + if (port->x_char) { + pch_uart_hal_write(priv, &port->x_char, 1); port->icount.tx++; + port->x_char = 0; tx_empty = 0; fifo_size--; } @@ -946,9 +931,11 @@ static unsigned int dma_handle_tx(struct } fifo_size = max(priv->fifo_size, 1); - if (pop_tx_x(priv, xmit->buf)) { - pch_uart_hal_write(priv, xmit->buf, 1); + + if (port->x_char) { + pch_uart_hal_write(priv, &port->x_char, 1); port->icount.tx++; + port->x_char = 0; fifo_size--; }