From: Andrew Goodbody Date: Thu, 2 Oct 2025 09:39:58 +0000 (+0100) Subject: fs: semihosting: Use correct variable for error check X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a58089ad2e41e88f81360f0e99bfd0715aceb556;p=pandora-u-boot.git 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") --- 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; }