Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4324993rdh; Tue, 28 Nov 2023 19:46:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFol97UyhhxRF+1ME6f4COjCnThJFgU76d0CUoyP9Ln8o6IlkSggm2QRKut5bJKyFVpv8r6 X-Received: by 2002:a05:6808:11c7:b0:3b2:f363:bbc9 with SMTP id p7-20020a05680811c700b003b2f363bbc9mr22597968oiv.53.1701229605011; Tue, 28 Nov 2023 19:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701229604; cv=none; d=google.com; s=arc-20160816; b=yJFUD3Jw0PT0wXYFCLpU9G2u0bhAXw4zxogjyAH4C63VnVL6cJVo3bvQPHif8b8cgD c6k2BXqac4xDC/07IdXvfeqP1xLQWgpI6kdjBqlUrT8XbDBC/dykSXKi7QOs4ZlNLJWC Ir7X8OCgccEX0Wrrh2jKlGH2u71NRmRT8lj11kvSku0Woa7qmbR60PHK+s65G9h5JiBb OxNaticCrDt3DuwOx9XpuHoHtPbgsvwZp7qMU83hxuYIPacuoNxP6wTFo60M20WlxJwb zBW7a3WFb428Luh21+e7P7ClYirroBXjgdbYlsQp60XithvAPUzzI1c8YPids/xik64+ nkZA== 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=50NgtX7SvQ7Ubnw7wnZdr9/ovViujYpH8S6F31BeVuI=; fh=xr2tRmJO5CCcvERKgUbQiCfZD8weRWjaLLzHWlvNSHA=; b=QiJ/6s+059iMhOTGqMdV2n7Jt2F3PiOnGyCQ5yYiDz66XchDF8DhFeCkT+6yPXwsCC 2H3tr38hx1gnedv8oen2DZTlJUvNQdC81VQPYxiYEkbiPEk0XgdCaWY/qiq6jygtB74x LxqnrGgBssGDls3sg2mIHzfCXUsQIxhsUfVftL4gJywBbEmWGn2nFNm4z/lr6XojIAZ1 N91eNpX2yraCmLaxGLxR+t5LpaBBaxn4ViORrnFtH+Fu6MBZGBREanJdyarQCHwSRx0n giw5OGZqb5WrkS0yI55NjN9nOOralpprrtdHZd+/BAUHltoPTFWPJsFP3sQZbvhzyYid 6Xuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="gVQFsS/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q3-20020a631f43000000b005c277ef191esi12964198pgm.295.2023.11.28.19.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 19:46:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="gVQFsS/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id C042C8090279; Tue, 28 Nov 2023 19:46:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376804AbjK2Dp7 (ORCPT + 99 others); Tue, 28 Nov 2023 22:45:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjK2Dp6 (ORCPT ); Tue, 28 Nov 2023 22:45:58 -0500 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF42DAF; Tue, 28 Nov 2023 19:46:04 -0800 (PST) Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-67a47104064so16036736d6.0; Tue, 28 Nov 2023 19:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701229564; x=1701834364; 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=50NgtX7SvQ7Ubnw7wnZdr9/ovViujYpH8S6F31BeVuI=; b=gVQFsS/by3aicyS8w9m8gEXhWVaQx+TNh4fVmc3X7nf+pI0d1Trkn+77D9/fOZQLMb oOiQGZ+DAjRWi8whEnHcXH5nUpgIoNX40ta4ub+UBWGFmVxlfFD7YZWprQPlw++B+6t3 q93X7krb7Z2oHbXfd66tOJ6Y17vo8/2rh4V0x9GqgwxUaUcfbmEKnACop+qntJaPyZrP oIcCrndmObv2d4nmAuDTBHHBIryWtHGB/7hpKCiJK7aa/NEKPVbbilGH+5zmqc1KOX4W 8uc3+pZQtY8rB8K0bQIVDbHHJ0Um17vMNA2RP1GLZEjA5R2WBVtB1VfgBk7CGXcdiFN6 9kJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701229564; x=1701834364; 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=50NgtX7SvQ7Ubnw7wnZdr9/ovViujYpH8S6F31BeVuI=; b=xR1bI7KrNx1nvOv+chLwwnMvSWPFjPRkWXk/5d+zniXzsdKUosdwZr7UtTuzFYL8yH 68EDWdajA7rVc2CwfuuGxsfxxCRUjg7wFBvpAXDFbfPgi5X6vPE6Ap1i07QKBFnlrHlg 2d+UsVSj6+PBeW1fM3fhsLhRzcPkVruu8oAsklPkzl5LWV7fusZ7oF0SMniFkZ6xDFSO SOivU9JNdavsVWo/SCmDWxdaVWUC5qMKvQyIwzY0jxMvMTbkUrwgU6t3F4842ntiCBzE 0aRZszHePzPp1kM8p6MH4CA6dwel9YUreDrONi+yhLvmct43ZgsFO+69dx7jC0Kob5cn sylA== X-Gm-Message-State: AOJu0Yy/oFHzrt21vpcGhQdhG6W86d5RT+zJW0UVwzPx9AKEnzRQI7tW Q9SJZG4p2tl22nu2YHw16lB1IKJ7AaRKsA== X-Received: by 2002:a05:6214:892:b0:67a:3efb:df5f with SMTP id cz18-20020a056214089200b0067a3efbdf5fmr10622237qvb.0.1701229563907; Tue, 28 Nov 2023 19:46:03 -0800 (PST) Received: from angquan-linux.. ([72.36.119.4]) by smtp.gmail.com with ESMTPSA id fb11-20020ad44f0b000000b0067a1201f3cbsm4882805qvb.100.2023.11.28.19.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 19:46:03 -0800 (PST) From: angquan yu X-Google-Original-From: angquan yu To: skhan@linuxfoundation.org Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, angquan yu Subject: [PATCH] selftests:proc: Resolve 'Unused Result' Warning from proc-empty-vm.c Date: Tue, 28 Nov 2023 21:45:56 -0600 Message-Id: <20231129034556.5719-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=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 19:46:21 -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 of the 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c index 5e7020630..d231e61e4 100644 --- a/tools/testing/selftests/proc/proc-empty-vm.c +++ b/tools/testing/selftests/proc/proc-empty-vm.c @@ -383,8 +383,10 @@ static int test_proc_pid_statm(pid_t pid) assert(rv <= sizeof(buf)); if (0) { ssize_t written = write(1, buf, rv); + if (written == -1) { perror("write failed to /proc/${pid}"); + return EXIT_FAILURE; } } -- 2.39.2