Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1499760rdb; Sat, 18 Nov 2023 21:06:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAbiD/aLzz3moJvf1RWnNeVL7FqsupITEt6q/f0trIN5biLc1sT7IsbhXXbknDkWDbgbeu X-Received: by 2002:a05:6a21:999d:b0:187:4e8c:ac5c with SMTP id ve29-20020a056a21999d00b001874e8cac5cmr5287987pzb.1.1700370416811; Sat, 18 Nov 2023 21:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700370416; cv=none; d=google.com; s=arc-20160816; b=Rc4lEIBU1XHNPDKM7QTHYxVzj4K7Z3yl6RTe/OElpiq5195PaNE4by6mF3J2Yfq0CE 4D+5ujyFU+IBv7pe3VFPwdlJ8OC804P4ra/UokIl4sznKUMYByPLOXzl8yO7Qdz3TaDL 0VNzFRsG2GKucLafO7eg3eWzWDaxbM1XHrWMaBPwEDMg4kmflUbsyvlBDbOSSSY1zOrY ujWvljtg9Re7s7DjBWqnuXb9SPpw9Azge0yESv/lCT5wWDYG52iQd8yG8vvfAAoyy4MA 2crxBwI9y6gQ61kcYFCAdd/HfX251HKwOLlIc7061IOzxwD4HATLoCti4lbaDwsNLTOn orXQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Ad+7DeeKonJPGSO2EixeCkfPYP/580kvKkx8jJr6+Sc=; fh=C32pWKLsohv6pM6YqzDl4H+Gr0pM56AwpQjFlvDKWGo=; b=ZfjvfBHMK0O+YftqwiCBxmC+qqff+lGYhyFXeqHtxzXLmVXq7TZp3uJO0KSuLw2LfV E+n+IYBW9kbsjwBbMJE1lvFpzVjbwuG32QhQdrM9sHKUSy3eQZEPZ3h6EYimnEbfbxRF 8jxpDJUOIZ/DiMaJDBCOrez90eR/MCc+5dxW17Q38vb7+RH9qencbkbfiGqjwLB8TvW0 0lMsvuYXCIb32U4zjO3Hi2pbYaWL7GeJkDJ+YyX4rx9wendxV4a2wwdgx5FBujqAQdJs ZIr5CkhWsOGPc2Tw4fCAiH+mXmqljoQX/FxzCNLKoHjTdo/4nUnjF4r+0klSohwVz2kW 2IqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="U6/Ce7S2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d13-20020a056a0010cd00b0068e3f550763si5823015pfu.101.2023.11.18.21.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="U6/Ce7S2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 125FB8059E55; Sat, 18 Nov 2023 21:06:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbjKSFGd (ORCPT + 99 others); Sun, 19 Nov 2023 00:06:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbjKSFGb (ORCPT ); Sun, 19 Nov 2023 00:06:31 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41EC6192; Sat, 18 Nov 2023 21:06:28 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-66d24ccc6f2so7556746d6.0; Sat, 18 Nov 2023 21:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700370386; x=1700975186; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ad+7DeeKonJPGSO2EixeCkfPYP/580kvKkx8jJr6+Sc=; b=U6/Ce7S20SxfDhHPfqVTdsivI2KF5mFZcQYjMCLlR7W6j6Qqu86NS+9cxXEXa8kS8u 4JeiCWON1N2VUS4qpJ76H/8Ca9qnBgkizbmLJmlnMikoQoACOx/gUfrf/WUk8Ue9XdPa 35ZufkeC/vYRbdGBeJb9IbXmkldNcbkPVaFQ4pq9CQ9ZMgabm6SdloYvGCn4z8neNyKO 9FmelPl0wHlri6xkPn69FC55x2Wy9iM4XUdKXTWG4qO+S5gkf/2RNC6avuwoumLY+SDH gleGxC89W8EhqTzUcpxszXqmwwpkWKxUu0B7KACnzcNpHxzqwTvxJj0BDEZplG2elbCL FKdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700370386; x=1700975186; 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=Ad+7DeeKonJPGSO2EixeCkfPYP/580kvKkx8jJr6+Sc=; b=LD/YF1vsdHDQx6UtEEW5N/uuBEy972fTaIDS0oX7xwhviIhapQPpcJUxc2r8FyDxS1 qieLOputHF/eoTx7pjV8Fd+CgDUe/mE5j2/2JQUxakShx4Sr9gCVvJV3+i8KygLO2Vv6 MYtBE37AMRzRvZtw21n/a5pA5TuDzq8CcFDJWTKP+vwZgaIDaCR5Z/A0Crya6c9/sHDG f7bdNN1hgv1cnJPGHpTKmtPyI5KN24UzuR1qeuXzIzOBGtMQu3qDiEDSH87ArDhEtnMS 46RBwbb24A2G+kR9gU+dfESkEv3kn5HEBmFlqtgvsTNbUQdyaoSAoaeAfRddO7jiBlRi t4gQ== X-Gm-Message-State: AOJu0YwRo0/3Snyv+NkwaNsIYu6H/q0C0B7U0hNMcl1VpCExmFtfz9fh lmH4tD2um4HKe1bsCFN3i8tIXYyA5VSbsfhx X-Received: by 2002:a05:6214:2341:b0:675:ac72:f4ce with SMTP id hu1-20020a056214234100b00675ac72f4cemr5209912qvb.28.1700370386558; Sat, 18 Nov 2023 21:06:26 -0800 (PST) Received: from angquan-linux.. ([72.36.119.4]) by smtp.gmail.com with ESMTPSA id n5-20020a0cec45000000b00679d4021621sm177070qvq.145.2023.11.18.21.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:06:26 -0800 (PST) From: angquan yu X-Google-Original-From: angquan yu To: linux-kselftest@vger.kernel.org Cc: kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, shuah@kernal.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, angquan yu Subject: [PATCH] selftests:proc-empty-vm: Remove unused debug write callIn the function test_proc_pid_statm Date: Sat, 18 Nov 2023 23:05:54 -0600 Message-Id: <20231119050554.52096-1-angquan21@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 18 Nov 2023 21:06:37 -0800 (PST) From: angquan yu In tools/testing/selftests/proc/proc-empty->because the return value of a write call was being ignored. This call was partof a conditional debugging block (if (0) { ... }), which meant it would neveractually execute. This patch removes the unused debug write call. This cleanup resolves the compi>warning about ignoring the result of write declared with the warn_unused_resultattribute. Removing this code also improves the clarity and maintainability ofthe function, as it eliminates a non-functional block of code. This is original warning: proc-empty-vm.c: In function ‘test_proc_pid_statm’:proc-empty-vm.c:385:17: warning: ignoring return value of ‘write’ declared with>385 | write(1, buf, rv);| Signed-off-by: angquan yu --- tools/testing/selftests/proc/proc-empty-vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c index 56198d4ca..74ef8627f 100644 --- a/tools/testing/selftests/proc/proc-empty-vm.c +++ b/tools/testing/selftests/proc/proc-empty-vm.c @@ -382,7 +382,10 @@ static int test_proc_pid_statm(pid_t pid) assert(rv >= 0); assert(rv <= sizeof(buf)); if (0) { - write(1, buf, rv); + ssize_t written = write(1, buf, rv); + if (written == -1) { + perror("write failed /proc/${pid}"); + } } const char *p = buf; -- 2.39.2