mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
selftests:kvm: fix get_trans_hugepagesz() ignoring fscanf() return warn
Fix get_trans_hugepagesz() to check fscanf() return value to get rid
of the following warning:
lib/test_util.c: In function ‘get_trans_hugepagesz’:
lib/test_util.c:138:2: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
138 | fscanf(f, "%ld", &size);
| ^~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
39a71f712d
commit
3a4f0cc693
|
|
@ -129,13 +129,16 @@ size_t get_trans_hugepagesz(void)
|
|||
{
|
||||
size_t size;
|
||||
FILE *f;
|
||||
int ret;
|
||||
|
||||
TEST_ASSERT(thp_configured(), "THP is not configured in host kernel");
|
||||
|
||||
f = fopen("/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", "r");
|
||||
TEST_ASSERT(f != NULL, "Error in opening transparent_hugepage/hpage_pmd_size");
|
||||
|
||||
fscanf(f, "%ld", &size);
|
||||
ret = fscanf(f, "%ld", &size);
|
||||
ret = fscanf(f, "%ld", &size);
|
||||
TEST_ASSERT(ret < 1, "Error reading transparent_hugepage/hpage_pmd_size");
|
||||
fclose(f);
|
||||
|
||||
return size;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user