linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] virtiofs: Move the assignment to ret outside the loop
@ 2020-09-23  2:07 Jing Xiangfeng
  0 siblings, 0 replies; only message in thread
From: Jing Xiangfeng @ 2020-09-23  2:07 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, linux-kernel, jingxiangfeng

There is no need to do the assignment each time. So move the assignment
to ret outside the loop.

Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
 fs/fuse/dax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index e394dba08cc4..f18cd7b53ec7 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -1259,9 +1259,9 @@ static int fuse_dax_mem_range_init(struct fuse_conn_dax *fcd)
 	pr_debug("%s: dax mapped %ld pages. nr_ranges=%ld\n",
 		__func__, nr_pages, nr_ranges);
 
+	ret = -ENOMEM;
 	for (i = 0; i < nr_ranges; i++) {
 		range = kzalloc(sizeof(struct fuse_dax_mapping), GFP_KERNEL);
-		ret = -ENOMEM;
 		if (!range)
 			goto out_err;
 
-- 
2.26.0.106.g9fadedd


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-23  2:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23  2:07 [PATCH -next] virtiofs: Move the assignment to ret outside the loop Jing Xiangfeng

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).