From patchwork Mon Jul 31 13:42:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13334651 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92FBDC001DF for ; Mon, 31 Jul 2023 13:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbjGaNmo (ORCPT ); Mon, 31 Jul 2023 09:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbjGaNmk (ORCPT ); Mon, 31 Jul 2023 09:42:40 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA65170C; Mon, 31 Jul 2023 06:42:39 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RDzqS6c3WztRgJ; Mon, 31 Jul 2023 21:39:16 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 31 Jul 2023 21:42:36 +0800 From: Li Zetao To: , , , CC: , , Subject: [PATCH -next] selftests: cgroup: Remove redundant if statements Date: Mon, 31 Jul 2023 21:42:05 +0800 Message-ID: <20230731134205.2723657-1-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org There is a warning reported by coccinelle: ./tools/testing/selftests/cgroup/test_zswap.c:211:6-18: WARNING: Unsigned expression compared with zero: stored_pages < 0 The type of "stored_pages" is size_t, which always be an unsigned type, so it is impossible less than zero. Drop the if statements to silence the warning. Signed-off-by: Li Zetao --- tools/testing/selftests/cgroup/test_zswap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index 49def87a909b..dbad8d0cd090 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -208,8 +208,6 @@ static int test_no_kmem_bypass(const char *root) free(trigger_allocation); if (get_zswap_stored_pages(&stored_pages)) break; - if (stored_pages < 0) - break; /* If memory was pushed to zswap, verify it belongs to memcg */ if (stored_pages > stored_pages_threshold) { int zswapped = cg_read_key_long(test_group, "memory.stat", "zswapped ");