From patchwork Thu Nov 18 09:58:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 12626435 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4981AC433F5 for ; Thu, 18 Nov 2021 09:59:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC869617E3 for ; Thu, 18 Nov 2021 09:59:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CC869617E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 384026B0073; Thu, 18 Nov 2021 04:59:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35A116B0072; Thu, 18 Nov 2021 04:59:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 185B76B0074; Thu, 18 Nov 2021 04:59:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 06F1D6B0072 for ; Thu, 18 Nov 2021 04:59:09 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BAE6E8249980 for ; Thu, 18 Nov 2021 09:58:58 +0000 (UTC) X-FDA: 78821602356.12.46D4AC8 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf11.hostedemail.com (Postfix) with ESMTP id 65716F00021A for ; Thu, 18 Nov 2021 09:58:58 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id c32so23305481lfv.4 for ; Thu, 18 Nov 2021 01:58:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7+O/tRzRt0aTbXVnB+DdljjU6ah6dRQd6+vFzdM3Bi4=; b=unyu7OwgDMXJdmdaeFF8QYwhR4gXJQ4N9ifkN9rUrT9S9jlc64bD+g5bvhgJ/idc21 mrXZTe7EAiwbDeh/ltOoWgTM+SWE8Pbi8bbX2PHF5bJSYsNE5daib5GWhY3VaelQyVCg qJ/+KQiQoGRJi1t3xJBhlp/ph+tuIa31a5ks4NXYUeSuMFUIxAtkT3gdjYFe0wpJb5MM FIJr3A/Gndm3YgULcXmA2q3Cl9zLeHu/CYqjtM1LAQHo9q95lWADqlBjVA3tUnD4541W XhLdjctdhxHLYCqbPlQT0wjpG1axTvu3lodzOi22YtfdgKQAHVUhVyIXkPbf/XcpQp8U 5yXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7+O/tRzRt0aTbXVnB+DdljjU6ah6dRQd6+vFzdM3Bi4=; b=7i2G2HXBZpTCSgt8FbCyaNmnVE5/t98Q8mAX5CmOvvrW+ywBYbZHI0ii83J4qhDcKs xx3BZ3TbOP+ruPTfQFiGiS+9X3Wy8Wi6Cfc3WK6unm2i8i9W4++OW2iVF3xapPhg4HxF 4gbE7fWO4HeaMHpVmGE2Hmdi/QPrqjCMA6TcnYvg29Gc5CozXAR+6PXUyAC9FRNPSmDs MD2vmQt+3IuKxaQp5EW2LYz/7wgo2ldOvDzG/5gl/OtoB3QHEexRMv9RMalHHBYbl0mu EfZye4GXN1I69+8fwQa3OY3JQUAKiry+Ev6rmWQ2uYMPgJRz8GJw5OiZPsztzDhQPuZL xkiQ== X-Gm-Message-State: AOAM530VBxxRcbXh6+4jHjckZLAbT2W0KvTqD2JTv0qwhsJ9tvtMPw88 mVvTwCkfS8nAsMiXqTndvAz0XA== X-Google-Smtp-Source: ABdhPJyi+0spX3wn1r8IFaINux9dkP2tBGxxKfV7B+JfDeMQFSuA+QsMIZDKPY/sicQmrojvlflXxg== X-Received: by 2002:a05:6512:1189:: with SMTP id g9mr22693442lfr.396.1637229537123; Thu, 18 Nov 2021 01:58:57 -0800 (PST) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id y28sm254570lfa.92.2021.11.18.01.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 01:58:56 -0800 (PST) From: Anders Roxell To: shuah@kernel.org Cc: fenghua.yu@intel.com, reinette.chatre@intel.com, john.stultz@linaro.org, tglx@linutronix.de, akpm@linux-foundation.org, nathan@kernel.org, ndesaulniers@google.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, llvm@lists.linux.dev, christian@brauner.io, Anders Roxell Subject: [PATCH v3 2/2] selftests: clone3: simplify return logic in clone3_set_tid() Date: Thu, 18 Nov 2021 10:58:52 +0100 Message-Id: <20211118095852.616256-2-anders.roxell@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211118095852.616256-1-anders.roxell@linaro.org> References: <20211118095852.616256-1-anders.roxell@linaro.org> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 65716F00021A X-Stat-Signature: k9qjp7o4awoabtnd4dcowz48rnd8dsk6 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=unyu7Owg; spf=pass (imf11.hostedemail.com: domain of anders.roxell@linaro.org designates 209.85.167.44 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (policy=none) header.from=linaro.org X-HE-Tag: 1637229538-421398 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use ksft_exit_* and exit instead of using goto. Signed-off-by: Anders Roxell Reviewed-by: Nick Desaulniers --- tools/testing/selftests/clone3/clone3_set_tid.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3_set_tid.c b/tools/testing/selftests/clone3/clone3_set_tid.c index a755fcd3af89..1b950c3c3b7c 100644 --- a/tools/testing/selftests/clone3/clone3_set_tid.c +++ b/tools/testing/selftests/clone3/clone3_set_tid.c @@ -250,7 +250,8 @@ int main(int argc, char *argv[]) * that all those tests are skipped as non-root. */ ksft_cnt.ksft_xskip += ksft_plan - ksft_test_num(); - goto out; + ksft_exit_skip( + "Please run the remaining tests as root - Exiting.\n"); } /* Find the current active PID */ @@ -371,9 +372,7 @@ int main(int argc, char *argv[]) close(pipe_2[1]); if (waitpid(ns_pid, &status, 0) < 0) { - ksft_print_msg("Child returned %s\n", strerror(errno)); - ret = -errno; - goto out; + ksft_exit_fail_msg("Child returned %s\n", strerror(errno)); } if (!WIFEXITED(status)) @@ -390,10 +389,6 @@ int main(int argc, char *argv[]) ksft_test_result_fail( "PIDs in all namespaces not as expected (%d,%d,%d)\n", ns3, ns2, ns1); -out: - ret = 0; - if (ret) - ksft_exit_fail(); ksft_exit_pass(); }