]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests: cachestat: Fix warning on declaration under label
authorSidharth Seela <sidharthseela@gmail.com>
Mon, 29 Sep 2025 11:54:06 +0000 (17:24 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:46:03 +0000 (11:46 +0100)
commit9fc7721ed0fce612921237a89c6e83b9a20b8e73
treeedd8101bc6599256677f4a2280f1f4a71669f14d
parent7b719a57ad0ee2bbf2a5bb623590d43631836619
selftests: cachestat: Fix warning on declaration under label

[ Upstream commit 920aa3a7705a061cb3004572d8b7932b54463dbf ]

Fix warning caused from declaration under a case label. The proper way
is to declare variable at the beginning of the function. The warning
came from running clang using LLVM=1; and is as follows:

-test_cachestat.c:260:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
  260 |                 char *map = mmap(NULL, filesize, PROT_READ | PROT_WRITE,
      |

Link: https://lore.kernel.org/r/20250929115405.25695-2-sidharthseela@gmail.com
Signed-off-by: Sidharth Seela <sidharthseela@gmail.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Reviewed-by: wang lian <lianux.mm@gmail.com>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/cachestat/test_cachestat.c