From patchwork Wed Apr 24 17:24:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642235 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3660C16D338; Wed, 24 Apr 2024 17:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979488; cv=none; b=d/vANw0mAcYAEkuM62cX4teuyQqPj2yQZj38fJJknuRhm9rzjVf4bOwhYQlv9fixhS6TxX5fLbwVJd1Vfn07fFgUUYTJJQRVA4E3FylMdWPrxeXetfePzBETJOfZVstG77AC04YP7+LgYhl2gn8tjV9OBDKM3AaVSxUqHj05sxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979488; c=relaxed/simple; bh=D85E1t//7pg4Je3S7QzI88EErnsJ7FlfVkbWF4PN0xM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BpA8BBZ1GAM8f6i5IvJXlCLNGvEUEXbXf/2XV3p019xBsI98ebSXFuUgijXaN3xFz/+TyxKuJ9a4LdASLCZ/MQKyfJ/ZAy5HdS7XHN7JLhxv+rBxcmsh5WNArJkxR6jacqLc6mT1UxmFVSlnKfqEO2UAJw+TwLaUOXHTj4A3GAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gBHzkQLO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gBHzkQLO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5BAEC32781; Wed, 24 Apr 2024 17:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979488; bh=D85E1t//7pg4Je3S7QzI88EErnsJ7FlfVkbWF4PN0xM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gBHzkQLO5b7D/YUZcX6pBuU7yTPmGpcG+6ecKmSOfoTtQrKC9hS4jX5/MedmdTM3b K57gbBOSvDbUmIYhxGhO2yXYlFPtBeOde4Gb1lRlLj6O48Yg/6cEz4A9fmpCNri7Lp hIie63HLVHyGN77c1dMoHCUmCuc5HtkDw/D/g0XmxTjY51n5Cct9h2mmfaJZ8Zc33o h1gh6jZQlBy6KAReXp2g60KLXtqwWo739lHYBwPdtUH1XhAixxw8AyJHu/ME6OGFNG QJxFtCK1lBkEK2kTD7VOQaFmr/ZFCtPdpCRMmRhPPSA4x0OwkpZ5PAAjtV5mfkLnQo Nhs46dUJryOTQ== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:04 -0700 Subject: [PATCH v2 01/10] selftests/clone3: ksft_exit functions do not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-1-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor , brauner@kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2113; i=nathan@kernel.org; h=from:subject:message-id; bh=D85E1t//7pg4Je3S7QzI88EErnsJ7FlfVkbWF4PN0xM=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDrEfXpufeRS1tEFutVdKklDZ5INhHfJ38xf2bRCxD jn5wrKuo5SFQYyLQVZMkaX6sepxQ8M5ZxlvnJoEM4eVCWQIAxenAEzkbjvDP1NV3h0fPkroflVJ P1ll+Ofcn6UZ1pf+rynx1YvfwLw5oIrhf3V3i4CFzYn3N6f4bV96f0/N7rCWfxve6894VTu7e3p vMA8A X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_{pass,fail}(), as __noreturn prevents the compiler from warning that a caller of the ksft_exit functions does not return a value because the program will terminate upon calling these functions. Just removing 'return' would have resulted in !ret ? ksft_exit_pass() : ksft_exit_fail(); so convert that into the more idiomatic if (ret) ksft_exit_fail(); ksft_exit_pass(); Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- Cc: brauner@kernel.org --- tools/testing/selftests/clone3/clone3_clear_sighand.c | 2 +- tools/testing/selftests/clone3/clone3_set_tid.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3_clear_sighand.c b/tools/testing/selftests/clone3/clone3_clear_sighand.c index 54a8b2445be9..ce0426786828 100644 --- a/tools/testing/selftests/clone3/clone3_clear_sighand.c +++ b/tools/testing/selftests/clone3/clone3_clear_sighand.c @@ -120,5 +120,5 @@ int main(int argc, char **argv) test_clone3_clear_sighand(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/clone3/clone3_set_tid.c b/tools/testing/selftests/clone3/clone3_set_tid.c index fbf813a5a06f..bfb0da2b4fdd 100644 --- a/tools/testing/selftests/clone3/clone3_set_tid.c +++ b/tools/testing/selftests/clone3/clone3_set_tid.c @@ -412,5 +412,7 @@ int main(int argc, char *argv[]) out: ret = 0; - return !ret ? ksft_exit_pass() : ksft_exit_fail(); + if (ret) + ksft_exit_fail(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642236 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BA1D516D4D3; Wed, 24 Apr 2024 17:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979488; cv=none; b=Ip8A1DmCaE1LQ/isK4zXDzNjWsVT5pVsUDNs3FI5+VhBXTVya21KWbP4cWUI0/RXJ8ANLvrjmkgLB2iWwi4OdtIjDiB+SJJlCwr6Y0Q10+DherS4x4wUTcQHF2IwlrZQKlq8067CHPg0aMJQF/p7kNUiqfehYJA8+FoWnaZZ448= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979488; c=relaxed/simple; bh=PR3dXKncRxSGgqWjw2pWaxvlcjI/h7WoRJup2DkHofg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qhkUY/GuGH9gbyZI+s6Sc0/XacEstCHIOZ19opCLoPUQGjut8irimHCXw5gKLB0RvH74puXH2eZJJzmQ1zI7lP3vvz94TG7NP6jdme8Lz1hYX5dl71ItiPN1x4KTkSGl+fC1NSFMDQPg9mVQj7dHz2M0Nm3a5nv5uCz2DWw305c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XR1ZQjoi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XR1ZQjoi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AE03C3277B; Wed, 24 Apr 2024 17:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979488; bh=PR3dXKncRxSGgqWjw2pWaxvlcjI/h7WoRJup2DkHofg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XR1ZQjoiqh/sHcf+Xk1GKpSbPeoaoDW7wI5XVnpOdx9f+z+zjuODRPHlwu6Q1CEED HSngUM0MNHOnID7XIL3Lqjewemvv1SVd9OStX1UlBuFBQ/4gaIyJ8EHyiv/+846KhM +qjFoSXzG+e8LY8lvgryCdmgJ7zKyLEeh1GlPxrTvq7YaHOhfaa94mHANk5b+HN1rx nBErRGm7TbRKmDI6/lUP3R3hQydpQof77N51vxieqKyD49gAz/dUw4s8hPHfrWL9xQ hZNLpHkNyUr95c3fEK46gh6LIwayfJMj3b5JmA0JmVc7R/8mbfaEzRBvuByl4pu+A4 CuMspbOiT4x/g== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:05 -0700 Subject: [PATCH v2 02/10] selftests/ipc: ksft_exit functions do not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-2-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2048; i=nathan@kernel.org; h=from:subject:message-id; bh=PR3dXKncRxSGgqWjw2pWaxvlcjI/h7WoRJup2DkHofg=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDrGT9JWUYtlUv17ZdL3GfdqlPOtN1z44JH/JCf4m1 de+rkK7o5SFQYyLQVZMkaX6sepxQ8M5ZxlvnJoEM4eVCWQIAxenAEzkQT8jw57kGGFf1XvshSyT xO3KPR8Y2H6ba9+3/1ZZdMov3fScRIb/3lZp7Ps/uxzbaNf8VnfL/O+72AWuSPifzqjTn/xj48V cRgA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_...(), as __noreturn prevents the compiler from warning that a caller of the ksft_exit functions does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- tools/testing/selftests/ipc/msgque.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index 656c43c24044..c75ea4094870 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c @@ -198,13 +198,12 @@ int main(int argc, char **argv) struct msgque_data msgque; if (getuid() != 0) - return ksft_exit_skip( - "Please run the test as root - Exiting.\n"); + ksft_exit_skip("Please run the test as root - Exiting.\n"); msgque.key = ftok(argv[0], 822155650); if (msgque.key == -1) { printf("Can't make key: %d\n", -errno); - return ksft_exit_fail(); + ksft_exit_fail(); } msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); @@ -243,13 +242,13 @@ int main(int argc, char **argv) printf("Failed to test queue: %d\n", err); goto err_out; } - return ksft_exit_pass(); + ksft_exit_pass(); err_destroy: if (msgctl(msgque.msq_id, IPC_RMID, NULL)) { printf("Failed to destroy queue: %d\n", -errno); - return ksft_exit_fail(); + ksft_exit_fail(); } err_out: - return ksft_exit_fail(); + ksft_exit_fail(); } From patchwork Wed Apr 24 17:24:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642237 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 88D2216D4F1; Wed, 24 Apr 2024 17:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979489; cv=none; b=fhmMKxtNDvR/KUGi/mCSHvfyPZyeZDBcTxm5e/dD63KwOhO0Ed3i+L28h92vae8L/gH/jYoYxeyUMaF141ESfSby5BtDkzwYfcrX+GBF2pB215CKkoWvCjxRGxafUF/2H5PdGENHpQrmW7SlJZNf2Z+Pd71Flj522EnEcdWYCDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979489; c=relaxed/simple; bh=mqainrt4XKLYv8z9kzm8G5QEs7BPDOFUczSJPMpBbf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t9NWYmjZVC2QyOtpu0nN4AZf1tDXhp8FbXcaxEy09dO7lk0+9pUTf2H+JJLWNREHj2kh86eXMM2sWZ1K77zQJQIvRNT8jBsCj8xdCHTxRdldSgu7Ll+q0APIV9Au4/Flw2+dqO78IPz9DwY8xkpxsEDMypSBGRWcHjVYIsnQhuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RQri94Qa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RQri94Qa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF86AC2BD11; Wed, 24 Apr 2024 17:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979489; bh=mqainrt4XKLYv8z9kzm8G5QEs7BPDOFUczSJPMpBbf4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RQri94QaNujD4nSl1pa6U3zylHpkeH3t7VIkaeTH7mS3kPyCwRx9Dk28CC+Auv1uf M5ePDrT3qVx+DR2IADn+PSp0xW+xlI51kbvPoq25QJpBwFBc3HY9soiUWfFtVCbQ2P MKg6Ac0a0Hg3ulRbkOOJbmYgfbL5hSW1KOBZGt27ztldIa4nZT/sCmFD6W+dNkU4Cw vXkYbyPSUidn6Ew6t+NLpYPgKaIORO+/1vgzKXBSoFiPsEl3/2JP3kSO1nPOgwWfJy 0WdR8X7LpptJvr1mTQP0BYErOAt7EQbcZsh4xTSfQiB48MbcXyevmRPCEjFexUMpTk g0LOz8CvV0sZg== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:06 -0700 Subject: [PATCH v2 03/10] selftests: membarrier: ksft_exit_pass() does not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-3-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2001; i=nathan@kernel.org; h=from:subject:message-id; bh=mqainrt4XKLYv8z9kzm8G5QEs7BPDOFUczSJPMpBbf4=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDrGp+XcZWmt3m6y3XJs+teveNYcZk7+9dPiUGJt4y C2p+ezXjlIWBjEuBlkxRZbqx6rHDQ3nnGW8cWoSzBxWJpAhDFycAjCR978ZGab8djvy0ND+1ZP1 DpPdu1oeVmn8yzTdl29+yyLht2Wk8xaG/0712dyhNkflWA83Ky2JYCks0i0L+HfpVfeH3eLtGSf a+AE= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_pass(), as __noreturn prevents the compiler from warning that a caller of ksft_exit_pass() does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- tools/testing/selftests/membarrier/membarrier_test_multi_thread.c | 2 +- tools/testing/selftests/membarrier/membarrier_test_single_thread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c b/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c index a9cc17facfb3..4e14dba81234 100644 --- a/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c +++ b/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c @@ -69,5 +69,5 @@ int main(int argc, char **argv) /* Multi-threaded */ test_mt_membarrier(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/membarrier/membarrier_test_single_thread.c b/tools/testing/selftests/membarrier/membarrier_test_single_thread.c index 4cdc8b1d124c..fa3f1d6c37a0 100644 --- a/tools/testing/selftests/membarrier/membarrier_test_single_thread.c +++ b/tools/testing/selftests/membarrier/membarrier_test_single_thread.c @@ -24,5 +24,5 @@ int main(int argc, char **argv) test_membarrier_get_registrations(/*cmd=*/0); - return ksft_exit_pass(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642238 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1D90716D9A9; Wed, 24 Apr 2024 17:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979490; cv=none; b=bSyHwtzYXs2LcVeRBbmiTzKSwIOG4Q2vQatlQSeAYYBTwjvsZ+sqY5tUbC5QE43rVcXOx+P08ecnctbu2epHvRtOCZmKmIFBZrlNWjs9N17xDZ0jPLxYm89fdBPlRBLxc2299hDwanWQgHj6VeXHhDx8DIxfWcIozpKdFZNdBH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979490; c=relaxed/simple; bh=GWpSfOZS2K51RIY5HOOiuGLu67UwmCDp9SYGDLDiQp4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jOsiE33xTIQ2eoPlTZekGHuXWSFEB/6lQFKpklZG/QfrBolNG5lODea2+LNhsU8kap7qnwB4ne0bafRQB3gewKSBK8LU1bRaAWaPLPngPGiKAONpSKonXLa5HoHpXL2M3LWCIczDzxe26D3qwi3naHax2xnBPgeR/4H1CBChzt0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tjD7nKIH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tjD7nKIH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4576BC4AF0F; Wed, 24 Apr 2024 17:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979489; bh=GWpSfOZS2K51RIY5HOOiuGLu67UwmCDp9SYGDLDiQp4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tjD7nKIHVmBOV3N5MSCSCjPY+RbJgOA7wKENGoAnKqQ4P415hy1U2lj6EjGgRf9wa KBufw4uZKfrb7T2BZ7v6RUq92GchH3l6yCVNdghNtPvBCi6WqwCbH8kkGU1MDzx1Sp Pe1ZZJNxPOG262JqBhdUlh2dFwZBz20MeAVXZINXrjKH6d10/VZ0b+vcKH2pTKBvgM JN/OymHrQYtqfLy/4SnFDi3f5oMQCFq91E0D13512HcAaHGHD+2nicb3KENxb4IJGL IJ48HdL2rU4VFsuPJTUUIlTN5ZqP3XkZIOrwmEFM7RxY6zboVQE1mSxMYILvXmFJch z+gLzmF8KfNtg== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:07 -0700 Subject: [PATCH v2 04/10] selftests/mm: ksft_exit functions do not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-4-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor , akpm@linux-foundation.org, linux-mm@kvack.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5922; i=nathan@kernel.org; h=from:subject:message-id; bh=GWpSfOZS2K51RIY5HOOiuGLu67UwmCDp9SYGDLDiQp4=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDrHdSRfSpIslJsW+bnT3PP9x327Gw8XK0gmTll1ad 1dt4YmyjlIWBjEuBlkxRZbqx6rHDQ3nnGW8cWoSzBxWJpAhDFycAjCR9d8YGTZKXH7y9Drf2408 D8z3mNifCD2+pf6gbHjPdM4CC6F+Vn5Ghgd3esNbxVZ2aJ7beGLJ4Z0PQ7lWPXs7h03sb1369ea J3owA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_...(), as __noreturn prevents the compiler from warning that a caller of the ksft_exit functions does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- Cc: akpm@linux-foundation.org Cc: linux-mm@kvack.org --- tools/testing/selftests/mm/compaction_test.c | 6 +++--- tools/testing/selftests/mm/cow.c | 2 +- tools/testing/selftests/mm/gup_longterm.c | 2 +- tools/testing/selftests/mm/gup_test.c | 4 ++-- tools/testing/selftests/mm/ksm_functional_tests.c | 2 +- tools/testing/selftests/mm/madv_populate.c | 2 +- tools/testing/selftests/mm/mkdirty.c | 2 +- tools/testing/selftests/mm/pagemap_ioctl.c | 4 ++-- tools/testing/selftests/mm/soft-dirty.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c index 533999b6c284..4f42eb7d7636 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -177,7 +177,7 @@ int main(int argc, char **argv) ksft_print_header(); if (prereq() || geteuid()) - return ksft_exit_skip("Prerequisites unsatisfied\n"); + ksft_exit_skip("Prerequisites unsatisfied\n"); ksft_set_plan(1); @@ -225,7 +225,7 @@ int main(int argc, char **argv) } if (check_compaction(mem_free, hugepage_size) == 0) - return ksft_exit_pass(); + ksft_exit_pass(); - return ksft_exit_fail(); + ksft_exit_fail(); } diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index 363bf5f801be..fe078d6e1806 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -1779,5 +1779,5 @@ int main(int argc, char **argv) if (err) ksft_exit_fail_msg("%d out of %d tests failed\n", err, ksft_test_num()); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c index ad168d35b23b..d7eaca5bbe9b 100644 --- a/tools/testing/selftests/mm/gup_longterm.c +++ b/tools/testing/selftests/mm/gup_longterm.c @@ -456,5 +456,5 @@ int main(int argc, char **argv) if (err) ksft_exit_fail_msg("%d out of %d tests failed\n", err, ksft_test_num()); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/gup_test.c b/tools/testing/selftests/mm/gup_test.c index 18a49c70d4c6..bd335cf9bc0e 100644 --- a/tools/testing/selftests/mm/gup_test.c +++ b/tools/testing/selftests/mm/gup_test.c @@ -228,7 +228,7 @@ int main(int argc, char **argv) break; } ksft_test_result_skip("Please run this test as root\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } p = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, filed, 0); @@ -267,5 +267,5 @@ int main(int argc, char **argv) free(tid); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c index d615767e396b..508287560c45 100644 --- a/tools/testing/selftests/mm/ksm_functional_tests.c +++ b/tools/testing/selftests/mm/ksm_functional_tests.c @@ -646,5 +646,5 @@ int main(int argc, char **argv) if (err) ksft_exit_fail_msg("%d out of %d tests failed\n", err, ksft_test_num()); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index 17bcb07f19f3..ef7d911da13e 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -307,5 +307,5 @@ int main(int argc, char **argv) if (err) ksft_exit_fail_msg("%d out of %d tests failed\n", err, ksft_test_num()); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c index 301abb99e027..b8a7efe9204e 100644 --- a/tools/testing/selftests/mm/mkdirty.c +++ b/tools/testing/selftests/mm/mkdirty.c @@ -375,5 +375,5 @@ int main(void) if (err) ksft_exit_fail_msg("%d out of %d tests failed\n", err, ksft_test_num()); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index d59517ed3d48..2d785aca72a5 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -1484,7 +1484,7 @@ int main(int argc, char *argv[]) ksft_print_header(); if (init_uffd()) - return ksft_exit_pass(); + ksft_exit_pass(); ksft_set_plan(115); @@ -1660,5 +1660,5 @@ int main(int argc, char *argv[]) userfaultfd_tests(); close(pagemap_fd); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 7dbfa53d93a0..d9dbf879748b 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -209,5 +209,5 @@ int main(int argc, char **argv) close(pagemap_fd); - return ksft_exit_pass(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642239 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ACCBA16D31D; Wed, 24 Apr 2024 17:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979490; cv=none; b=h3StIh3Zjg9VzuynidpEraKOrNtjuJEkVhQNcWgaJQFRbd/5jXvUuj1JII0ImIFDDh6k8RL0IinKJ3Ot402CxAYiJ9iU1ydRBsc6AmpwXdhJtT4C2RZ4rvDm6+B39Kr/qXe6KY2reiS5cftpjgr3iosmi5EI2uqBTuDsTs/6T48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979490; c=relaxed/simple; bh=GnpqSQLHhE9QIs4mApLVYgT9NC1Q6eMd9yABsVnk8j8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JEtfp4iEOKxQaJkNFlD8ZTeuG7Wb4WsIh+znbOmHwQtk8L6a+oBSF/hOIVDFc37ck0Qy2LIUEPzYJT3dp1yRQacGeg3mDlVF5haBIxqsQKl9g/afhRctmNk7iqgHBPQPYdTCGaV7z6wfpFHBHKWiSu2KCLyGY4hU+ZxduI90YXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZMmmYxFm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZMmmYxFm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C07C32782; Wed, 24 Apr 2024 17:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979490; bh=GnpqSQLHhE9QIs4mApLVYgT9NC1Q6eMd9yABsVnk8j8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZMmmYxFmkxqr6EGMIEdJOKDUoe4iwcxYecdSsASu3l9kgwWQuPWYPWzOP8TrAvktt ItDxhEjcJCgroyYbYzP0/iNRlQ4kv70QTPHrhJ/4SbBrXq2k3YtMLI4TngXuDJS9Rl 0xPiYYSsOHviWC4igwp/8Wg7aLwWYurqdrzEkP93hGdN9bCcd0HccnXBGrSI5u/wPu mk6J1mxtBAU6IuLyvJ24VrKyEmSYeaPzsbT3B8WKzaJYUGj8/fT6lz/mokM1YS1Ig+ zY8LNidK7GdtQSStD1vhtpsbokkWO9pgNM4mmhoYtdiiW70+7SFK5WHmRKK+rUofsu jR9A8Z79i4VeA== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:08 -0700 Subject: [PATCH v2 05/10] selftests: pidfd: ksft_exit functions do not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-5-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor , brauner@kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3118; i=nathan@kernel.org; h=from:subject:message-id; bh=GnpqSQLHhE9QIs4mApLVYgT9NC1Q6eMd9yABsVnk8j8=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDrER567ENQR2/vHeM/WakPvFHfa/xUWtu4vyved3M aetmWXYUcrCIMbFICumyFL9WPW4oeGcs4w3Tk2CmcPKBDKEgYtTACYi/Yvhvw8nXxHbhX0huXqm 7vzCp5nuX1Dg+vBTTbkr86uV3RQDO0aG+7Jzmje/tmi7lTXvq/IsR5s5jlciuuqrl9aZXgmRVCp jBAA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_{pass,fail}(), as __noreturn prevents the compiler from warning that a caller of the ksft_exit functions does not return a value because the program will terminate upon calling these functions. Just removing 'return' would have resulted in !ret ? ksft_exit_pass() : ksft_exit_fail(); so convert that into the more idiomatic if (ret) ksft_exit_fail(); ksft_exit_pass(); Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- Cc: brauner@kernel.org --- tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 2 +- tools/testing/selftests/pidfd/pidfd_open_test.c | 4 +++- tools/testing/selftests/pidfd/pidfd_poll_test.c | 2 +- tools/testing/selftests/pidfd/pidfd_test.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c index 01cc37bf611c..f062a986e382 100644 --- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c +++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c @@ -307,5 +307,5 @@ int main(int argc, char **argv) test_pidfd_fdinfo_nspid(); test_pidfd_dead_fdinfo(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/pidfd/pidfd_open_test.c b/tools/testing/selftests/pidfd/pidfd_open_test.c index 8a59438ccc78..c62564c264b1 100644 --- a/tools/testing/selftests/pidfd/pidfd_open_test.c +++ b/tools/testing/selftests/pidfd/pidfd_open_test.c @@ -159,5 +159,7 @@ int main(int argc, char **argv) if (pidfd >= 0) close(pidfd); - return !ret ? ksft_exit_pass() : ksft_exit_fail(); + if (ret) + ksft_exit_fail(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/pidfd/pidfd_poll_test.c b/tools/testing/selftests/pidfd/pidfd_poll_test.c index 610811275357..55d74a50358f 100644 --- a/tools/testing/selftests/pidfd/pidfd_poll_test.c +++ b/tools/testing/selftests/pidfd/pidfd_poll_test.c @@ -112,5 +112,5 @@ int main(int argc, char **argv) } ksft_test_result_pass("pidfd poll test: pass\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index c081ae91313a..9faa686f90e4 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -572,5 +572,5 @@ int main(int argc, char **argv) test_pidfd_send_signal_exited_fail(); test_pidfd_send_signal_recycled_pid_fail(); - return ksft_exit_pass(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642240 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5712016DEAF; Wed, 24 Apr 2024 17:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979491; cv=none; b=IhXXExXz0RYKppLErJWkCgXvAmTQPFuFgh7RO+3+XcITI7B+UHCX+5X6z1d7fHbazvOINQ37ND3bWuqa6XKXZlKLltb5xEuv2lzcIMTVsgaXwnsfEgW0efaX5gTQHsTjnrCcJjZV/jqpEyK3aFjPzCq4KFOXYRUB9mTLoBofxLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979491; c=relaxed/simple; bh=cbwXLUzf5rGrGLbVqXwjzoKstLI0lqOQorsdMr4ifh8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hcVv9Q20QHW6ls3p1m2JOvNFjEs956xlRTQyWG6d4MwixULWSW8pyAkWFzpiM1p6iN/WoywZVGt2IAc1fxN4drRfDHAmq3Snmf7idCIhJLsNukIBQIrRFSMpShVMtgl8jnwY/VXIcTc5jaR85jdowg0A5W0hsuULECJFiHTFKGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MV21QbgY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MV21QbgY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A3EDC3277B; Wed, 24 Apr 2024 17:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979490; bh=cbwXLUzf5rGrGLbVqXwjzoKstLI0lqOQorsdMr4ifh8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MV21QbgY7CCa9neeHsfXBmUaU96U5y2cNR4uGaqN+fAQTrZth8CH0yiIy3tHlqbn5 EpdoPcmpjff/tRFt+QfUn2/OzmqKPmXpRjqwxUXKZV2fX479Nvl3WmckRGoscSZK+/ PT8Oww/7rSt3UcIO4lT9BNtAdedZa4UIEjRyja3XH4gODxMg5uBvnFk3U2gp1GOJ4B P8a33GWOHsiTsPRPGnDx1YI7v3iRrNozRrB3YN1b68Wl/yCeRrZwQ+rS2Wx2kdUQqA 4xu6kvLVCJc5JSf7Nm1UB61aGTSRJmTcc77QAR1qvHPaoVeW6OVRNyc+Gk+8A9ZHGk kBVITrG4eP/qw== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:09 -0700 Subject: [PATCH v2 06/10] selftests/resctrl: ksft_exit_skip() does not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-6-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor , fenghua.yu@intel.com, reinette.chatre@intel.com X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1878; i=nathan@kernel.org; h=from:subject:message-id; bh=cbwXLUzf5rGrGLbVqXwjzoKstLI0lqOQorsdMr4ifh8=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDnHfcs7mOxotzC2KjWT6KNSt9GjeEyGbh09eeWx6s 07jh2FERykLgxgXg6yYIkv1Y9XjhoZzzjLeODUJZg4rE8gQBi5OAZjIbymG/1XCzxwY9meeb+v9 9FpuwuzrOcliy8zkGTbuuyq567pZxRpGht/JNtv2f2BStYq0ve5YdrdpF5vBvMS56zib9S/MezT pKTMA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_skip(), as __noreturn prevents the compiler from warning that a caller of ksft_exit_skip() does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- Cc: fenghua.yu@intel.com Cc: reinette.chatre@intel.com --- tools/testing/selftests/resctrl/resctrl_tests.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 348d17cb2a84..ecbb7605a981 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -247,13 +247,13 @@ int main(int argc, char **argv) * 2. We execute perf commands */ if (geteuid() != 0) - return ksft_exit_skip("Not running as root. Skipping...\n"); + ksft_exit_skip("Not running as root. Skipping...\n"); if (!check_resctrlfs_support()) - return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n"); + ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n"); if (umount_resctrlfs()) - return ksft_exit_skip("resctrl FS unmount failed.\n"); + ksft_exit_skip("resctrl FS unmount failed.\n"); filter_dmesg(); From patchwork Wed Apr 24 17:24:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642241 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 899D216DEC0; Wed, 24 Apr 2024 17:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979491; cv=none; b=H4suWT27rq0SwhmXA51PSal1G287/Bm21u0dBxMKwyQh54VHjb8GDMyGTphIJgqYl/a8SBwhRYLW3XwM3YnP1mwOLdtcPATCvdUasJYmzaDPaN/BRp6DGObyDaxVSYhGe+HCihSAnRWV7EfiagQHs2mDiEpBwhbrYJJ5mXyOXow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979491; c=relaxed/simple; bh=5bcOCoiv7z9bfpXac60/pYpWDL3JKCADJVEOACSTLEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VdAdGxO4aILsrX107PNV2Jmb+UpMmbKLYo1xxF2VGD3UGGdSEbS0V1Pdxz2cvkOzxM1OeoEhb2oim0/4t5KsqhwbIha8YScnRvFOFlNk69WaY0RZVSBI1adfT6nBRIfGSgUTIg4a/FCTnLCdfwyNnILwMBVYfX+Wi1CCUC4XSxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KEtFpn6D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KEtFpn6D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E8BFC32783; Wed, 24 Apr 2024 17:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979491; bh=5bcOCoiv7z9bfpXac60/pYpWDL3JKCADJVEOACSTLEc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KEtFpn6Djbjd3G8efcGjKrZ+LHJkH1roOgg0pvoRMuf6FhZhZ28z71t/YXJNIqcij sabee9Gkh/XXWXgokwh/Y/iARR5EgmP52up2YrmrtrXbjO6DNv1vKTy0zpMzp/UXBH fMxx5/NA4P7Ud3ObdZsLVnU79HAPFNMxBRsyUXuRbYTbOhsW+JnCh9fGoHIYu5IdYR Mm1z2hzLFeVF73pLL6PA7q9CYoEqsfsuQjDt4HdzNo6sGbhWSYknaPgbr81UhqG/8z LeVhcyZWW+39UmH2Bm29fvMuaUBOns5O+QfTeuPUa0ulBYX8CyEfFfPssXYgWI5lt/ mnDlw+rUha5XA== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:10 -0700 Subject: [PATCH v2 07/10] selftests: sync: ksft_exit_pass() does not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-7-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1415; i=nathan@kernel.org; h=from:subject:message-id; bh=5bcOCoiv7z9bfpXac60/pYpWDL3JKCADJVEOACSTLEc=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDnEN/026bMynTmIPjTmzklVk3zyzyo0hh1Vv2iq8V gjp5wvoKGVhEONikBVTZKl+rHrc0HDOWcYbpybBzGFlAhnCwMUpABOxlmf478F3/8oL2+Dc+ULd XYKiHKU3ThRfXWM1X9FtkVb24fOdLAz/FJfv+C2/0GbChnc/5J2+XuIu0vzOk1T07ki/+Z2Ldsu n8wEA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the call to ksft_exit_pass(), as __noreturn prevents the compiler from warning that a caller of ksft_exit_pass() does not return a value because the program will terminate upon calling these functions (which is what the comment alluded to as well). Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- tools/testing/selftests/sync/sync_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/sync/sync_test.c b/tools/testing/selftests/sync/sync_test.c index 414a617db993..93db5aa246a3 100644 --- a/tools/testing/selftests/sync/sync_test.c +++ b/tools/testing/selftests/sync/sync_test.c @@ -109,6 +109,5 @@ int main(void) ksft_exit_fail_msg("%d out of %d sync tests failed\n", err, ksft_test_num()); - /* need this return to keep gcc happy */ - return ksft_exit_pass(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642242 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93F2A16E86F; Wed, 24 Apr 2024 17:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979492; cv=none; b=lFFf9bOQQMP6wgd0d52zxUBQniqa0LCgzwhzbXRYwR+A4BSiwKKUbkGHVoaOwispRnLPNUWYda24t7vlLRvWAz92iE8+eJnDEJ99NGv0u/KTGK6jh5ct/72cyJ68eTA+6udVK8z77vCt0+IyE5R4RNM7YxEhbrJNDPLI2xy5tmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979492; c=relaxed/simple; bh=xQtYMXWzkLVGZHdWC5Izl0gg9cD9NA5pclKWj3MDh4U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ioriYm41qUVBH77xasKPJihYNrFSpA5Kc8sw03r+xltRBOPrs866IEtk1hvnK8BT0PY01e8etQF3fIy27VNGF/xhH5/n/nCO5DZlU36vOSYzloEPszmNDppAldPlTPuP9GvN1rq+vtyTjCJGMw6fHSrYAQk+CDhAacSRru7Zt1k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cwclI1v0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cwclI1v0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9902BC4AF09; Wed, 24 Apr 2024 17:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979492; bh=xQtYMXWzkLVGZHdWC5Izl0gg9cD9NA5pclKWj3MDh4U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cwclI1v09jZJ0b3O31Np5kCOnR0XdE/gChAnWhzSlEpJ88ivq3AFFee7Vys3XnlKI t/K7QLax1V4LtptTOh+sCuGwJi4csqeE4pxPo7Smog7zTCullCGY2ZePDPN+jpy7ht dXpY04HyS1U7L3VuuPj4KYLT2UqI1mif0IjDwrx1a+Q3T38Lpe9A3Ve8tTFAYNSYx7 ZsxJY8uDPtmLhZuWlEnAQBKdR5jk682SrI27HoESavF+STnPRc3LL9ydPXY6CQZSPx +5RTYinLqZOb4O+DN94j5JnhTG0CUErg1bESkLWQm6IoOoPBo7px/sBKZUZxtzCROy b6wJ/QYjN8avA== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:11 -0700 Subject: [PATCH v2 08/10] selftests: timers: ksft_exit functions do not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-8-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor , anna-maria@linutronix.de, frederic@kernel.org, tglx@linutronix.de, jstultz@google.com, sboyd@kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=11801; i=nathan@kernel.org; h=from:subject:message-id; bh=xQtYMXWzkLVGZHdWC5Izl0gg9cD9NA5pclKWj3MDh4U=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDnGK59ZZczbttlizzLcx9aPCwn7pT+zTIr64Pe5+l v5cZeucjlIWBjEuBlkxRZbqx6rHDQ3nnGW8cWoSzBxWJpAhDFycAjCRE1sYfrN+txaojlnwqO3z 4Wf3ZY6LshVej7O/ciX3iHCrw4XvbTcY/unwCxuL5VplHa/vu8F5+YJ/6M7aeIHc35IifPWqp0L 1+QA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_...(), as __noreturn prevents the compiler from warning that a caller of the ksft_exit functions does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- Cc: anna-maria@linutronix.de Cc: frederic@kernel.org Cc: tglx@linutronix.de Cc: jstultz@google.com Cc: sboyd@kernel.org --- tools/testing/selftests/timers/adjtick.c | 4 ++-- tools/testing/selftests/timers/alarmtimer-suspend.c | 4 ++-- tools/testing/selftests/timers/change_skew.c | 4 ++-- tools/testing/selftests/timers/freq-step.c | 4 ++-- tools/testing/selftests/timers/leap-a-day.c | 10 +++++----- tools/testing/selftests/timers/leapcrash.c | 4 ++-- tools/testing/selftests/timers/mqueue-lat.c | 4 ++-- tools/testing/selftests/timers/posix_timers.c | 12 ++++++------ tools/testing/selftests/timers/raw_skew.c | 6 +++--- tools/testing/selftests/timers/set-2038.c | 4 ++-- tools/testing/selftests/timers/set-tai.c | 4 ++-- tools/testing/selftests/timers/set-timer-lat.c | 4 ++-- tools/testing/selftests/timers/set-tz.c | 4 ++-- tools/testing/selftests/timers/skew_consistency.c | 4 ++-- tools/testing/selftests/timers/threadtest.c | 2 +- tools/testing/selftests/timers/valid-adjtimex.c | 6 +++--- 16 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftests/timers/adjtick.c index 47e05fdc32c5..205b76a4abb4 100644 --- a/tools/testing/selftests/timers/adjtick.c +++ b/tools/testing/selftests/timers/adjtick.c @@ -205,7 +205,7 @@ int main(int argc, char **argv) adjtimex(&tx1); if (err) - return ksft_exit_fail(); + ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c index 4332b494103d..ad52e608b88e 100644 --- a/tools/testing/selftests/timers/alarmtimer-suspend.c +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c @@ -173,6 +173,6 @@ int main(void) timer_delete(tm1); } if (final_ret) - return ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_fail(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/change_skew.c b/tools/testing/selftests/timers/change_skew.c index 992a77f2a74c..4421cd562c24 100644 --- a/tools/testing/selftests/timers/change_skew.c +++ b/tools/testing/selftests/timers/change_skew.c @@ -89,8 +89,8 @@ int main(int argc, char **argv) if (ret) { printf("[FAIL]"); - return ksft_exit_fail(); + ksft_exit_fail(); } printf("[OK]"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/freq-step.c b/tools/testing/selftests/timers/freq-step.c index 4b76450d78d1..73b636f89fdc 100644 --- a/tools/testing/selftests/timers/freq-step.c +++ b/tools/testing/selftests/timers/freq-step.c @@ -257,7 +257,7 @@ int main(int argc, char **argv) set_frequency(0.0); if (fails) - return ksft_exit_fail(); + ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/leap-a-day.c b/tools/testing/selftests/timers/leap-a-day.c index 23eb398c8140..986abbdb1521 100644 --- a/tools/testing/selftests/timers/leap-a-day.c +++ b/tools/testing/selftests/timers/leap-a-day.c @@ -268,7 +268,7 @@ int main(int argc, char **argv) if (ret < 0) { printf("Error: Problem setting STA_INS/STA_DEL!: %s\n", time_state_str(ret)); - return ksft_exit_fail(); + ksft_exit_fail(); } /* Validate STA_INS was set */ @@ -277,7 +277,7 @@ int main(int argc, char **argv) if (tx.status != STA_INS && tx.status != STA_DEL) { printf("Error: STA_INS/STA_DEL not set!: %s\n", time_state_str(ret)); - return ksft_exit_fail(); + ksft_exit_fail(); } if (tai_time) { @@ -295,7 +295,7 @@ int main(int argc, char **argv) se.sigev_value.sival_int = 0; if (timer_create(CLOCK_REALTIME, &se, &tm1) == -1) { printf("Error: timer_create failed\n"); - return ksft_exit_fail(); + ksft_exit_fail(); } its1.it_value.tv_sec = next_leap; its1.it_value.tv_nsec = 0; @@ -366,7 +366,7 @@ int main(int argc, char **argv) if (error_found) { printf("Errors observed\n"); clear_time_state(); - return ksft_exit_fail(); + ksft_exit_fail(); } printf("\n"); if ((iterations != -1) && !(--iterations)) @@ -374,5 +374,5 @@ int main(int argc, char **argv) } clear_time_state(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/leapcrash.c b/tools/testing/selftests/timers/leapcrash.c index f70802c5dd0d..8fd065eec904 100644 --- a/tools/testing/selftests/timers/leapcrash.c +++ b/tools/testing/selftests/timers/leapcrash.c @@ -87,7 +87,7 @@ int main(void) tv.tv_usec = 0; if (settimeofday(&tv, NULL)) { printf("Error: You're likely not running with proper (ie: root) permissions\n"); - return ksft_exit_fail(); + ksft_exit_fail(); } tx.modes = 0; adjtimex(&tx); @@ -104,5 +104,5 @@ int main(void) fflush(stdout); } printf("[OK]\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/selftests/timers/mqueue-lat.c index 7916cf5cc6ff..f3179a605bba 100644 --- a/tools/testing/selftests/timers/mqueue-lat.c +++ b/tools/testing/selftests/timers/mqueue-lat.c @@ -107,8 +107,8 @@ int main(int argc, char **argv) ret = mqueue_lat_test(); if (ret < 0) { printf("[FAILED]\n"); - return ksft_exit_fail(); + ksft_exit_fail(); } printf("[OK]\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index c001dd79179d..07c81c0093c0 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -260,16 +260,16 @@ int main(int argc, char **argv) ksft_print_msg("based timers if other threads run on the CPU...\n"); if (check_itimer(ITIMER_VIRTUAL) < 0) - return ksft_exit_fail(); + ksft_exit_fail(); if (check_itimer(ITIMER_PROF) < 0) - return ksft_exit_fail(); + ksft_exit_fail(); if (check_itimer(ITIMER_REAL) < 0) - return ksft_exit_fail(); + ksft_exit_fail(); if (check_timer_create(CLOCK_THREAD_CPUTIME_ID) < 0) - return ksft_exit_fail(); + ksft_exit_fail(); /* * It's unfortunately hard to reliably test a timer expiration @@ -281,10 +281,10 @@ int main(int argc, char **argv) * find a better solution. */ if (check_timer_create(CLOCK_PROCESS_CPUTIME_ID) < 0) - return ksft_exit_fail(); + ksft_exit_fail(); if (check_timer_distribution() < 0) - return ksft_exit_fail(); + ksft_exit_fail(); ksft_finished(); } diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c index 6eba203f9da7..030143eb09b4 100644 --- a/tools/testing/selftests/timers/raw_skew.c +++ b/tools/testing/selftests/timers/raw_skew.c @@ -137,11 +137,11 @@ int main(int argc, char **argv) if (tx1.offset || tx2.offset || tx1.freq != tx2.freq || tx1.tick != tx2.tick) { printf(" [SKIP]\n"); - return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n"); + ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n"); } printf(" [FAILED]\n"); - return ksft_exit_fail(); + ksft_exit_fail(); } printf(" [OK]\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/set-2038.c b/tools/testing/selftests/timers/set-2038.c index 688cfd81b531..f7d978721b9e 100644 --- a/tools/testing/selftests/timers/set-2038.c +++ b/tools/testing/selftests/timers/set-2038.c @@ -128,6 +128,6 @@ int main(int argc, char *argv[]) /* restore clock */ settime(start); if (ret) - return ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_fail(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/set-tai.c b/tools/testing/selftests/timers/set-tai.c index 8c4179ee2ca2..5b67462efcd6 100644 --- a/tools/testing/selftests/timers/set-tai.c +++ b/tools/testing/selftests/timers/set-tai.c @@ -61,9 +61,9 @@ int main(int argc, char **argv) ret = get_tai(); if (ret != i) { printf("[FAILED] expected: %i got %i\n", i, ret); - return ksft_exit_fail(); + ksft_exit_fail(); } } printf("[OK]\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c index 50da45437daa..7ce240c89b21 100644 --- a/tools/testing/selftests/timers/set-timer-lat.c +++ b/tools/testing/selftests/timers/set-timer-lat.c @@ -278,6 +278,6 @@ int main(void) ret |= do_timer_oneshot(clock_id, 0); } if (ret) - return ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_fail(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/set-tz.c b/tools/testing/selftests/timers/set-tz.c index 62bd33eb16f0..20daaf1782b7 100644 --- a/tools/testing/selftests/timers/set-tz.c +++ b/tools/testing/selftests/timers/set-tz.c @@ -102,9 +102,9 @@ int main(int argc, char **argv) printf("[OK]\n"); set_tz(min, dst); - return ksft_exit_pass(); + ksft_exit_pass(); err: set_tz(min, dst); - return ksft_exit_fail(); + ksft_exit_fail(); } diff --git a/tools/testing/selftests/timers/skew_consistency.c b/tools/testing/selftests/timers/skew_consistency.c index 63913f75b384..c8e6bffe4e0a 100644 --- a/tools/testing/selftests/timers/skew_consistency.c +++ b/tools/testing/selftests/timers/skew_consistency.c @@ -70,8 +70,8 @@ int main(int argc, char **argv) if (ret) { printf("[FAILED]\n"); - return ksft_exit_fail(); + ksft_exit_fail(); } printf("[OK]\n"); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/threadtest.c b/tools/testing/selftests/timers/threadtest.c index 80aed4bf06fb..76b38e41d9c7 100644 --- a/tools/testing/selftests/timers/threadtest.c +++ b/tools/testing/selftests/timers/threadtest.c @@ -189,5 +189,5 @@ int main(int argc, char **argv) /* die */ if (ret) ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_pass(); } diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c index d13ebde20322..d500884801d8 100644 --- a/tools/testing/selftests/timers/valid-adjtimex.c +++ b/tools/testing/selftests/timers/valid-adjtimex.c @@ -320,10 +320,10 @@ int validate_set_offset(void) int main(int argc, char **argv) { if (validate_freq()) - return ksft_exit_fail(); + ksft_exit_fail(); if (validate_set_offset()) - return ksft_exit_fail(); + ksft_exit_fail(); - return ksft_exit_pass(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642243 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D367816E88D; Wed, 24 Apr 2024 17:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979492; cv=none; b=csq1amXV7cZfl6hf3MXZ2FlCrDp4ldw2I0i2y37g7oacwa1f6XVjdx9GS0BgSrAfifFWBxmyDwc4AKVRAVSiXe6NXt11YsQe3xZRIuKqGSr8GcWM4knNWity70Xs7Z3GtMB09MEAc18dqLqR/71z/FPiI9a/1s6s1Qv8n8FbO/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979492; c=relaxed/simple; bh=opc/avona9eW/rM3roW/voeHSXTty1uKIg/G6um8klI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k0/oHFuUSBehHLg/7fjdNGzQ9HjeelXH1lYjUNdioDTKTWgoy3zGU5wPyJM71KD488Pit++7tSWUNEp7tT5BnZFbIdp5B+aZFXopWxTNh3jsWjrjE0/cZp8YtrRBd/wVW6X4AZEMTZjCaT9MKiAmvJzgwln1HQTtYBgRiKwACD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UN6PsVgY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UN6PsVgY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 583A9C4AF0E; Wed, 24 Apr 2024 17:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979492; bh=opc/avona9eW/rM3roW/voeHSXTty1uKIg/G6um8klI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UN6PsVgYRWhbxPqKK2/Ai7IUcQDxfQEaMTGFCytdrOCHkBtBH2+2a/HKEtoNYb9bR ddAHN0CvMVcOxCLtU7c/3l6Z/g/9rozme40fPzmeV/MRRlJwRICRDK3FpMiLlsXLOV IhtCGYQNnb7Iv8O3fpo7Bz/pazhQHoWNSKT4fdb2adVAdgCc4784kT0OfC417td/Y3 ZAO0wgCHnbUQidhCcANVz6uVqnYuNMbAu/tTf3hT2bjIAOXG6Z6JK8vYyI7W4+sU9Q /PHNTgY+G3X3j2LfMRHAzhh4FZnTb7vCMP1wRuS2zYhYd0fzeUvbn1MHmZBfSMz8RZ AGmP7wiyz6KXA== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:12 -0700 Subject: [PATCH v2 09/10] selftests: x86: ksft_exit_pass() does not return Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-9-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1248; i=nathan@kernel.org; h=from:subject:message-id; bh=opc/avona9eW/rM3roW/voeHSXTty1uKIg/G6um8klI=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDnHBa269iNZUCrt6y+ioYi5X+9cjZ4Jc3tUlcrGUZ 2wviG3sKGVhEONikBVTZKl+rHrc0HDOWcYbpybBzGFlAhnCwMUpABNxFmL4XxL7rdlJ7UVvQXKj ObuDQVe3ybKK+lMx++raThe+jJy6j5FhV9uKpxo6JxZt71291f4v+3W11ys+pX0TazYVT33wd34 fGwA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 After commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the call to ksft_exit_pass(), as __noreturn prevents the compiler from warning that a caller of ksft_exit_pass() does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- tools/testing/selftests/x86/lam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c index 215b8150b7cc..820db4864292 100644 --- a/tools/testing/selftests/x86/lam.c +++ b/tools/testing/selftests/x86/lam.c @@ -1237,5 +1237,5 @@ int main(int argc, char **argv) ksft_set_plan(tests_cnt); - return ksft_exit_pass(); + ksft_exit_pass(); } From patchwork Wed Apr 24 17:24:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13642244 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 96F7F16EC1C; Wed, 24 Apr 2024 17:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979493; cv=none; b=F0sLoktt2ZqJHpQaH4FEYR2BSvzyTpwGhsOtXiCfhrenRVdyeT84hSCNDmCM8YpWLfzRPOLLi3U0nb4r7HxMpXiAue5QoJBKdP0bvfo9mc6F2s+pBQG5durRSltWUZvrKQKSsBgLzzqJ2oFgEYbkixO7iTi3s564ArUkcwHuS0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979493; c=relaxed/simple; bh=jLnC6a51kXShlJw2qowP2td/Td80RuzryZnAn9alooQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PtR0Em4oSWwabzR03W2Vc6Nbvh6S/pWMLAgYhgIkk62vbpW6ni1DqktMFfPIHdDCOSvvDsVzKtxoXfwyS/BVcrmtMxicmu/jdNe36vap4ntfx5tfmG7SLvvMqfGy4MgYxuZdeW10CAAo8oDw/Sht8USfk+7bA9MabTam/Psj7kg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wf7uOyy7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wf7uOyy7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D51EDC32782; Wed, 24 Apr 2024 17:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713979493; bh=jLnC6a51kXShlJw2qowP2td/Td80RuzryZnAn9alooQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Wf7uOyy7k7KnS1BWaCftOUBBDmNwEqjDxrD2bRGq3sqLpzDu66SEp5QzmNLVwpTfl OQi/YyWlbrexteK+VwwTWbS+Ql6xMP2+EppRESjhdm+l1zetkgi2iFI9M2bN2e2fsr ZOP8yleTVnYvzSAH8P/nYu1vKN4IrBOx8vFQkItBnmkBFZe4GqyLxiCSz8Quaa6sWI TJxpuFsK5jZEc0UKyk5AQj9dUwVktSLP6AbXRU9ojT7de7xQMYfAci/kCK49jSM9LD 6Qh5hK5KH4bprzAA26LROwUBWSFES6E1kuYrAAa07juuWXrSUMcZLq8zRScznC4iUx fjnFNIGqHplHQ== From: Nathan Chancellor Date: Wed, 24 Apr 2024 10:24:13 -0700 Subject: [PATCH v2 10/10] selftests: kselftest: Make ksft_exit functions return void instead of int Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240424-ksft-exit-int-to-void-v2-10-c35f3b8c9ca0@kernel.org> References: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> In-Reply-To: <20240424-ksft-exit-int-to-void-v2-0-c35f3b8c9ca0@kernel.org> To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum , Thomas Gleixner , Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2619; i=nathan@kernel.org; h=from:subject:message-id; bh=jLnC6a51kXShlJw2qowP2td/Td80RuzryZnAn9alooQ=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGmaDnFWTGLpkbE/c97N0rukZGv/etKc3Z+DTyzmXBC/o SJY+y1LRykLgxgXg6yYIkv1Y9XjhoZzzjLeODUJZg4rE8gQBi5OAZjIwWeMDB3WvA8+tyje8Kl5 sNpY9XCeYkFjzsOOvcZ8S97P+KBy+w8jw5/IzW9n3mxau0d7Gouv689JYUsUt62XZE98/2x1fYK DMxsA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 Commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn") marked functions that call exit() as __noreturn but it did not change the return type of these functions from 'void' to 'int' like it should have (since a noreturn function by definition cannot return an integer because it does not return...) because there were many tests that return the result of the ksft_exit functions, even though it has never been used due to calling exit(). Now that all uses of 'return ksft_exit...()' have been cleaned up properly, change the types of the ksft_exit...() functions to void to match their __noreturn nature. Reviewed-by: Muhammad Usama Anjum Reviewed-by: Thomas Gleixner Signed-off-by: Nathan Chancellor --- tools/testing/selftests/kselftest.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 9bb1664bcf95..f4221691a7da 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -327,13 +327,13 @@ void ksft_test_result_code(int exit_code, const char *test_name, break; \ } } while (0) -static inline __noreturn int ksft_exit_pass(void) +static inline __noreturn void ksft_exit_pass(void) { ksft_print_cnts(); exit(KSFT_PASS); } -static inline __noreturn int ksft_exit_fail(void) +static inline __noreturn void ksft_exit_fail(void) { ksft_print_cnts(); exit(KSFT_FAIL); @@ -360,7 +360,7 @@ static inline __noreturn int ksft_exit_fail(void) ksft_cnt.ksft_xfail + \ ksft_cnt.ksft_xskip) -static inline __noreturn __printf(1, 2) int ksft_exit_fail_msg(const char *msg, ...) +static inline __noreturn __printf(1, 2) void ksft_exit_fail_msg(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -388,19 +388,19 @@ static inline __noreturn void ksft_exit_fail_perror(const char *msg) #endif } -static inline __noreturn int ksft_exit_xfail(void) +static inline __noreturn void ksft_exit_xfail(void) { ksft_print_cnts(); exit(KSFT_XFAIL); } -static inline __noreturn int ksft_exit_xpass(void) +static inline __noreturn void ksft_exit_xpass(void) { ksft_print_cnts(); exit(KSFT_XPASS); } -static inline __noreturn __printf(1, 2) int ksft_exit_skip(const char *msg, ...) +static inline __noreturn __printf(1, 2) void ksft_exit_skip(const char *msg, ...) { int saved_errno = errno; va_list args;