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 <andrew.goodbody@linaro.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Fixes: f676b45151 ("fs: Add semihosting filesystem")
This commit is contained in:
Andrew Goodbody
2025-10-02 10:39:58 +01:00
committed by Tom Rini
parent 64a4645c4e
commit a58089ad2e

View File

@@ -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;
}