* [PATCH] f2fs: return success if there is no work to do
@ 2021-05-15 18:09 trix
2021-05-17 1:19 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2021-05-15 18:09 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
Static analysis reports this problem
file.c:3206:2: warning: Undefined or garbage value returned to caller
return err;
^~~~~~~~~~
err is only set if there is some work to do. Because the loop returns
immediately on an error, if all the work was done, a 0 would be returned.
Instead of checking the unlikely case that there was no work to do,
change the return of err to 0.
Signed-off-by: Tom Rix <trix@redhat.com>
---
fs/f2fs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ceb575f99048c..bae0f910f5f0a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3203,7 +3203,7 @@ int f2fs_precache_extents(struct inode *inode)
map.m_lblk = m_next_extent;
}
- return err;
+ return 0;
}
static int f2fs_ioc_precache_extents(struct file *filp, unsigned long arg)
--
2.26.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: return success if there is no work to do
2021-05-15 18:09 [PATCH] f2fs: return success if there is no work to do trix
@ 2021-05-17 1:19 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2021-05-17 1:19 UTC (permalink / raw)
To: trix, jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel
On 2021/5/16 2:09, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Static analysis reports this problem
> file.c:3206:2: warning: Undefined or garbage value returned to caller
> return err;
> ^~~~~~~~~~
>
> err is only set if there is some work to do. Because the loop returns
> immediately on an error, if all the work was done, a 0 would be returned.
> Instead of checking the unlikely case that there was no work to do,
> change the return of err to 0.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-17 1:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 18:09 [PATCH] f2fs: return success if there is no work to do trix
2021-05-17 1:19 ` [f2fs-dev] " Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).