From patchwork Sat Feb 24 22:28:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 205957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1341146dyb; Sat, 24 Feb 2024 14:29:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWnvKmI95Fo6RFmaDA0lqutEwBDkqnTFhhPYOtCr4JVOqaLsMawfHYqlqsz+VdfU3rn7x/ObN9R4lAu+cdT3itK1DiraQ== X-Google-Smtp-Source: AGHT+IGs4h4aNv8utb+btQ4trojuQ829Ux9+u65UL7Sn1wvWx9BTT5ExeNoBGI4ypGpowt+ap9t8 X-Received: by 2002:a17:906:198d:b0:a3e:4553:ba31 with SMTP id g13-20020a170906198d00b00a3e4553ba31mr2264632ejd.28.1708813740270; Sat, 24 Feb 2024 14:29:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708813740; cv=pass; d=google.com; s=arc-20160816; b=zLW/me/CntUhJEOqgdTLMgXm3lctRPg68GWJINQsYaVDEfArcuSUSSkauHa4CJzsyd WmDjDZeTZubNSnM2FoRznMTSTK1LyANdzt82PsscfMugt02tFF/wmNEmx/SZBwBxc04S aLrY1FQzqIVe7wpnHIozQw8I9Xz3gWhv5EbZOs0d6rIURQXeERALey5oSq4e8LZuBfeO 4aCSf2TIseBZ6xTEXZo86iZst7mlY8O4bsaU0FfC403cO5MKcQV0eBmcJglrD5fntnN1 gXzeXglKn4Z/lcZt9GcRtxOeV0wKIaYtcPufwBmTQG5LrO7I824E7g8c4IdB+sTEdwJb guYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:date:cc:to:from:subject :message-id; bh=MULlS3M5DL3da9KRtHEXTdoyTQUjInFUyW8UT3IJkDY=; fh=YRHNhMezCWZgf3Hp4DYnyN755Q1W02zr+khUR6sSvIc=; b=Xxi0zP/05RWXWsoA07Ywof/3+EKzZv8ud+NMoJ7O6thHNbAbqIvsZxgCcSdag7TAWz W6YYqrP2kF2djjL6GclM7OuyHFSVK02I+jXZ00OEVrV726Q4wCrYqAl71phX3Lq3EYeX rUYH6DDV7FtI56z61vdjv1Z/+T/wHpQxdjAyjGzYDiBwlk3lpYUvAEBrsTXzg3B9otVt LRD6wopSsihYs1jForD4fIIw4kFS81Rzn8Rq/7+XoGVTg430b1v5doQYYMTj60vwqNVh 3NrUC+YMw5PybCqqHIr3BRce4TU2Wqb9Bpz8e89ifDkcK/wy4xzJ/PoW52nB+tO2Dq2U GXig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-kernel+bounces-79889-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79889-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h15-20020a1709063b4f00b00a3fc1f04a9asi789015ejf.549.2024.02.24.14.29.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 14:29:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79889-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-kernel+bounces-79889-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79889-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B1DCE1F218C9 for ; Sat, 24 Feb 2024 22:28:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA0824DA12; Sat, 24 Feb 2024 22:28:46 +0000 (UTC) Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A540481C6; Sat, 24 Feb 2024 22:28:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708813725; cv=none; b=ngfYuXklIrMds4GbQq/aU2cu+slPSiLfS3ywh/Sx+t4e5sDdhKJy7AIhECukUKZaWMQeIYk4Ck89naJZFOPgjNFVqs4Rh2zN98ORMDQ6RIeSfqYNRHEKaZiyjOMMk/d3jho2kYXNqSYlH8gykhmswC5gHvBPij/XXvsY2qWDA2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708813725; c=relaxed/simple; bh=XFvUuIiArPZtcIaAv5GeV7fVRjc1Q38QRdmJEDP+YqI=; h=Message-ID:Subject:From:To:Cc:Date:Content-Type:MIME-Version; b=j27zvObdMaK9yPEibBE5keEkEkfHYxHf26cATsX9GbUkjkBlVSfcLeP2xLjO5ydyd/vJ1MNswSY4NfalJtrw6AyZmRgi8DYdjSWrJtMkS+EF4ki3mY79dgnlPHp/i9s7RvgF0d9Ew0jFS0DnDwpr514oulCXXHx/K3eL2Zp1/5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DF5C780453; Sat, 24 Feb 2024 22:28:35 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA id DAB2317; Sat, 24 Feb 2024 22:28:33 +0000 (UTC) Message-ID: <2cf0b77f51b907969ae83993854773961b4e159c.camel@perches.com> Subject: sibyte: pointless if tests From: Joe Perches To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, LKML Date: Sat, 24 Feb 2024 14:28:32 -0800 User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: DAB2317 X-Rspamd-Server: rspamout02 X-Stat-Signature: rbkbkkufbwqdzrt4f99nfrgmpaseaoh4 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+8vWvWo4t1B6xMC3gg99zgB4EFce9pg9I= X-HE-Tag: 1708813713-824061 X-HE-Meta: U2FsdGVkX1+Uaj7nWPg01jMtq1aN1QyBgqKd4hIUp8kgnnMMpD8AQgkQ59G1gLz5gLxSsCdBlwN/sAaz/Lwq8H7tNI/yngwf54hagJEGeHuKHIgN+g7yHdDMLGgwKOD4bovS0jUzMoVAcGMPRmn0o/oASUxLXmy1UzRtbuXh+DV16aIRowGpzBL7xtyo56qsOyC1koZ6uBGROzytO87qxOCse/lvk3pO7j6D4vN7RyepyXOUWJaM8Jjp1KOdxhLgnLNMH5jrMNtn3OPb3Sxfm54iOnRiG1P/JUejNr6wc3JbqenSKq6P01tF5xuDH/Uc X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791821076729263819 X-GMAIL-MSGID: 1791821076729263819 A checkpatch modification was suggested privately about braces around an if test like if (foo) ; so I thought I'd see how many of these possibly pointless if tests exist. There aren't many. Here are a couple in sibyte: Maybe this should be documented as: "well, don't know what to do here" $ cat if_semi.cocci @@ expression e; @@ * if (e) ; $ spatch --very-quiet -sp-file if_semi.cocci . diff -u -p ./arch/mips/sibyte/common/cfe_console.c /tmp/nothing/arch/mips/sibyte/common/cfe_console.c --- ./arch/mips/sibyte/common/cfe_console.c +++ /tmp/nothing/arch/mips/sibyte/common/cfe_console.c @@ -22,8 +22,6 @@ static void cfe_console_write(struct con if (str[i] == '\n') { do { written = cfe_write(cfe_cons_handle, &str[last], i-last); - if (written < 0) - ; last += written; } while (last < i); while (cfe_write(cfe_cons_handle, "\r", 1) <= 0) @@ -33,8 +31,6 @@ static void cfe_console_write(struct con if (last != count) { do { written = cfe_write(cfe_cons_handle, &str[last], count-last); - if (written < 0) - ; last += written; } while (last < count); }