2021-05-12 09:20:17

by Yang Li

[permalink] [raw]
Subject: [PATCH] configfs: Remove redundant initialization of 'len'

variable 'len' is being initialized however
this value is never read as 'len' is assigned a new
value in if statement. Remove the redundant assignment.
At the same time, adjust the declarations order of
variables to keep the "upside-down x-mas tree" look of them.

Cleans up clang warning:
fs/configfs/file.c:147:10: warning: Value stored to 'len' during its
initialization is never read [clang-analyzer-deadcode.DeadStores]

Reported-by: Abaci Robot <[email protected]>
Fixes: 'commit fa60ce2cb450 ("treewide: remove editor modelines and cruft")'
Signed-off-by: Yang Li <[email protected]>
---
fs/configfs/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index e26060d..1551b3d 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -141,10 +141,10 @@ static int fill_read_buffer(struct file *file, struct configfs_buffer *buffer)
configfs_read_bin_file(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
- struct configfs_fragment *frag = to_frag(file);
struct configfs_buffer *buffer = file->private_data;
+ struct configfs_fragment *frag = to_frag(file);
ssize_t retval = 0;
- ssize_t len = min_t(size_t, count, PAGE_SIZE);
+ ssize_t len;

mutex_lock(&buffer->mutex);

--
1.8.3.1


2021-05-25 10:12:51

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] configfs: Remove redundant initialization of 'len'

Thanks, but this isn't needed anymore with the patch from Bart that
implements ->read_iter instead of ->read.