From patchwork Sat Feb 11 15:45:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 13137137 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D344C61DA4 for ; Sat, 11 Feb 2023 15:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kHiHjDKHTnaF7og8Fqh6lE59oNicQ0ss1eePuFqeUbA=; b=mc+Lwmia89w7IY NBDTRB5pqr6pAKet347VgGJ+odChx4UZJeo1+/ZwbjIFmPwfkK5Jk5VuhMgRE80iSRn8IG/MkPgEN 9A8P+2EWXVU/BzbmVYwKl8ywsCFDLkd1pQRwlbhy7XhnGLCxyaZU9Q8J3ROFtVFVQqRYgeFTn+Yxp VuFQGW4IXpMVwwTTglo1mmjSf82bmFm/zoUt+q34VXP3G/VHA0z4aHacdt2IzqxMR2OlgrnY2wN+T cMODkAQ/M++r/9Ro0wy8go1F/6vwIqjd2NjNcQ8qV9WNaon04HQ3ELHS36zKtTL98aQAcvesoesq7 Si78AN9YaeCJ8nZQG+7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQs4t-009lMP-MK; Sat, 11 Feb 2023 15:46:15 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQs4p-009lLl-6F for linux-arm-kernel@lists.infradead.org; Sat, 11 Feb 2023 15:46:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676130363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O7XkEjMNE8+iiPDaPqXuL/eN3ShpzX6KK4M/D+SJvvE=; b=YbEi32Z3oHOpkHZOdWur0779HiRKIu2h40I+F3cHgwLu/+hCQgUjAxWOUz/O8ykP+4C4+k KaGbRlvjzSZFZXr8DAFpCnWi5ysKNlvOEGVihd9MMO7HhgYRoHsX1gtoYD+P7B2/rVWzRn 4B7FoV61+XLuHawV+4rnnlXanGbwtRQ= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-658-muGlXRPjOWemNbA_FDFVuQ-1; Sat, 11 Feb 2023 10:46:01 -0500 X-MC-Unique: muGlXRPjOWemNbA_FDFVuQ-1 Received: by mail-qt1-f199.google.com with SMTP id i5-20020ac813c5000000b003b86b748aadso4904464qtj.14 for ; Sat, 11 Feb 2023 07:46:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O7XkEjMNE8+iiPDaPqXuL/eN3ShpzX6KK4M/D+SJvvE=; b=VQnleoz0eAQrkRc6DeR8nlsq/3sUnRX4V2TesYqXVDeUeFMKRgWuJfZlIr13qfEw8L 3oLsFatVYaBuXF8WTBEqKAFf+uOfbp6jjDo+D8kAHHba444srIWSxnx54a58/kzOIa9b IeUtF/H67T4OWOkmiDDQPwFQIypY+FYIxTwxVAE5ofzsiO+iHLeDTRW6+5Q67ozpIMWL 6AT/3T7vlhVs6U6sULWJ1OOKmdC+cruXa9P+sk3aY23+TTkR9Fd4Dn3NBK/7hMeGIg1f 0lhYyd6qehuCq/KOAS+K6x8gGRa01CNKIuNK74tK2Ap3ujul+vIGagDXRJHAn025p+2g hODQ== X-Gm-Message-State: AO0yUKXeqS0EKc6D9zYiDaBir51t1eYPnnFM4ZW3saoH9PlV4L6bH/gN K6h9x3X7eZI+FYo9axhIRRi57XgEFLZqmJ2YZ0KQnw9wLRAJCgAre9x/YotpZDml88LKTExSz58 w6MVXlbbFNun2AIZyojwIgRAfKDwXmlyDLb0= X-Received: by 2002:a05:622a:64b:b0:3bb:89be:8b45 with SMTP id a11-20020a05622a064b00b003bb89be8b45mr12440591qtb.65.1676130361194; Sat, 11 Feb 2023 07:46:01 -0800 (PST) X-Google-Smtp-Source: AK7set8TgpagNQyMM/EhhmI5d/iFi5OKGZteX6jyu06UbjTHrtPOUeLawnKurMDXLzcWPn3V5YiZCA== X-Received: by 2002:a05:622a:64b:b0:3bb:89be:8b45 with SMTP id a11-20020a05622a064b00b003bb89be8b45mr12440558qtb.65.1676130360863; Sat, 11 Feb 2023 07:46:00 -0800 (PST) Received: from borg.redhat.com (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id t187-20020ae9dfc4000000b0073902217c00sm4697750qkf.23.2023.02.11.07.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 07:46:00 -0800 (PST) From: Tom Rix To: gregkh@linuxfoundation.org, jirislaby@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com Cc: linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tom Rix Subject: [PATCH] serial: imx: remove a redundant check Date: Sat, 11 Feb 2023 07:45:50 -0800 Message-Id: <20230211154550.2130670-1-trix@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230211_074611_348839_374AF99E X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org cpp_check reports drivers/tty/serial/imx.c:1207:15: style: Condition 'r_bytes>0' is always true [knownConditionTrueFalse] if (r_bytes > 0) { r_byte is set to r_bytes = rx_ring->head - rx_ring->tail; The head - tail calculation is also done by the earlier check if (rx_ring->head <= sg_dma_len(sgl) && rx_ring->head > rx_ring->tail) { so r_bytes will always be > 0, so the second check is not needed. Signed-off-by: Tom Rix Reviewed-by: Iuliana Prodan --- drivers/tty/serial/imx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 363c77a140f0..523f296d5747 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1204,11 +1204,9 @@ static void imx_uart_dma_rx_callback(void *data) r_bytes = rx_ring->head - rx_ring->tail; /* If we received something, check for 0xff flood */ - if (r_bytes > 0) { - spin_lock(&sport->port.lock); - imx_uart_check_flood(sport, imx_uart_readl(sport, USR2)); - spin_unlock(&sport->port.lock); - } + spin_lock(&sport->port.lock); + imx_uart_check_flood(sport, imx_uart_readl(sport, USR2)); + spin_unlock(&sport->port.lock); if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ)) {