From a58089ad2e41e88f81360f0e99bfd0715aceb556 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Thu, 2 Oct 2025 10:39:58 +0100 Subject: [PATCH] fs: semihosting: Use correct variable for error check After calling a function that can return an error, the test to detect that error should use the return value not a different variable. Fix it. This issue was found by Smatch. Signed-off-by: Andrew Goodbody Reviewed-by: Sean Anderson Fixes: f676b45151c3 ("fs: Add semihosting filesystem") --- fs/semihostingfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/semihostingfs.c b/fs/semihostingfs.c index 77e39ca407e..9d7a136b9ba 100644 --- a/fs/semihostingfs.c +++ b/fs/semihostingfs.c @@ -35,7 +35,7 @@ static int smh_fs_read_at(const char *filename, loff_t pos, void *buffer, } if (!maxsize) { size = smh_flen(fd); - if (ret < 0) { + if (size < 0) { smh_close(fd); return size; } -- 2.47.3