diff mbox series

[-next] selftests: cgroup: Remove redundant if statements

Message ID 20230731134205.2723657-1-lizetao1@huawei.com (mailing list archive)
State New
Headers show
Series [-next] selftests: cgroup: Remove redundant if statements | expand

Commit Message

lizetao July 31, 2023, 1:42 p.m. UTC
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 <lizetao1@huawei.com>
---
 tools/testing/selftests/cgroup/test_zswap.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Tejun Heo July 31, 2023, 11:42 p.m. UTC | #1
On Mon, Jul 31, 2023 at 09:42:05PM +0800, Li Zetao wrote:
> 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 <lizetao1@huawei.com>

Looks fine to me but the zswap test addition is going through akpm's tree, I
think, so probably best to repost it to Andrew.

Thanks.
diff mbox series

Patch

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 ");