Skip to contentSkip to conversation

papr_vpd.c: calling devfd before get_system_loc_code

PATCH Applied R Nageswara Sastry 2 participants 2 messages Jan 31, 2024 – Feb 15, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 papr_vpd.c: calling devfd before get_system_loc_code

Calling get_system_loc_code before checking devfd and errno - fails the test when the device is not available, expected a SKIP.
Change the order of 'SKIP_IF_MSG' correctly SKIP when the /dev/papr-vpd device is not available.

with out patch: Test FAILED on line 271
with patch: [SKIP] Test skipped on line 266: /dev/papr-vpd not present

---
 tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c +2 -2
index 98cbb9109ee6..505294da1b9f 100644
@@ -263,10 +263,10 @@ static int papr_vpd_system_loc_code(void)
 	off_t size;
 	int fd;
 
-	SKIP_IF_MSG(get_system_loc_code(&lc),
-		    "Cannot determine system location code");
 	SKIP_IF_MSG(devfd < 0 && errno == ENOENT,
 		    DEVPATH " not present");
+	SKIP_IF_MSG(get_system_loc_code(&lc),
+		    "Cannot determine system location code");
 
 	FAIL_IF(devfd < 0);
 
Signature · 1 line
2.37.1 (Apple Git-137.1)
#1 lore raw
Quoted 9 lines · R Nageswara Sastry

Calling get_system_loc_code before checking devfd and errno - fails the test when the device is not available, expected a SKIP.
Change the order of 'SKIP_IF_MSG' correctly SKIP when the /dev/papr-vpd device is not available.

with out patch: Test FAILED on line 271
with patch: [SKIP] Test skipped on line 266: /dev/papr-vpd not present

[...]

Applied to powerpc/fixes.

[1/1] papr_vpd.c: calling devfd before get_system_loc_code

      https://git.kernel.org/powerpc/c/f09696279b5dd1770a3de2e062f1c5d1449213ff

cheers