Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp940730pxb; Wed, 3 Mar 2021 21:53:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrXuWYfFKP88A2oYk5t93IF1Ft46LL8QKsL1tvTwcj9T0f+LI/ndiNPCeTz7NwYnljyU7v X-Received: by 2002:a17:906:a099:: with SMTP id q25mr2380992ejy.549.1614837212266; Wed, 03 Mar 2021 21:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614837212; cv=none; d=google.com; s=arc-20160816; b=grQ0PgUtEcyfZp8AlDiQxt1SAiG82JAXgCxmUPMtSPjevrpPrG8oqDFpeEZ4WfWR5m LaMrBQI7sZ8gnTDXGZS/otTwvfJo5GdmPjAuJ1SGRW+gcOo9/ajHJiayRlGSKwfFzmjZ 3Wl4dUSdE3ZuIje6q0k60zh071FCKcrE8++wjddk8eXlTzObbh3BXbzFzGqGLtek9FaJ QG7Oe6GEBMQCVfJJiFyv5VoDWH6vW1GB6GJrkGWtSIvpThFtrIeoUdbhDYpR2c5iN+2l n4WqZSyNxEqmkxi88sWJfGngo8Gz8M2ogmlpwXsZin3dSC64m6nfv4fT8jBGX89ELcmo 3R1A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kN2DszDx3fiNOlY1kebs0+7DD6QnpvqDacKQ8O9wyDg=; b=T5887yPEM4t4BVO6drRAlIIoan66e2LPbeYBVTcVDcxuTEMv6sOkYqP2qM+WJ0c2E8 CN1kuzLdPftKa7CVDJ1XVXg2doma+tzATqvqkN7V1JPkgEDx/a7Y3fKHcNyhSn7nULuT U7gOkSpUTaAnmKaz+SHK+XEZunpXgTRUVYx+fuapavcO6vJkPeYnAkLaG/plSHgN9atX x/kzbB3M0U0Q4DO9M+e1jH/fbBLT7m4UeHkx4bSGWpNVxg/f4dGPehaRnQVlg7Oij9m7 c//hmyl7RRJZ/RW22/sEJ5Zse7F2BWWaUbVB6cPmb5VkG2pMI/jIZioz0/YKdrYIf5EO AMUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si16614295ejc.520.2021.03.03.21.53.09; Wed, 03 Mar 2021 21:53:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577069AbhCBHSa (ORCPT + 99 others); Tue, 2 Mar 2021 02:18:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:39620 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835902AbhCBGZX (ORCPT ); Tue, 2 Mar 2021 01:25:23 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AE136B062; Tue, 2 Mar 2021 06:22:22 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 43/44] tty: make everyone's chars_in_buffer return >= 0 Date: Tue, 2 Mar 2021 07:22:13 +0100 Message-Id: <20210302062214.29627-43-jslaby@suse.cz> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210302062214.29627-1-jslaby@suse.cz> References: <20210302062214.29627-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The tty line disciplines don't expect tty_operations::chars_in_buffer to return negative values. Fix the two drivers which violate this. Signed-off-by: Jiri Slaby --- drivers/tty/n_gsm.c | 2 +- drivers/tty/vcc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 7e1d19805aa4..da10e975829f 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3056,7 +3056,7 @@ static int gsmtty_chars_in_buffer(struct tty_struct *tty) { struct gsm_dlci *dlci = tty->driver_data; if (dlci->state == DLCI_CLOSED) - return -EINVAL; + return 0; return kfifo_len(&dlci->fifo); } diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c index 04a792749816..3106df98558a 100644 --- a/drivers/tty/vcc.c +++ b/drivers/tty/vcc.c @@ -896,7 +896,7 @@ static int vcc_chars_in_buffer(struct tty_struct *tty) port = vcc_get_ne(tty->index); if (unlikely(!port)) { pr_err("VCC: chars_in_buffer: Failed to find VCC port\n"); - return -ENODEV; + return 0; } num = port->chars_in_buffer; -- 2.30.1