* [PATCH] nfs: direct: drop useless initializer in nfs_direct_write_completion()
@ 2025-04-08 20:53 Sergey Shtylyov
2025-04-09 20:40 ` Sergey Shtylyov
2025-04-11 11:04 ` Benjamin Coddington
0 siblings, 2 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2025-04-08 20:53 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, linux-nfs; +Cc: lvc-project
In nfs_direct_write_completion(), the local variable req isn't used outside
the *while* loop and is assigned to right at the start of that loop's body,
so its initializer appears useless -- drop it; then move the declaration to
the loop body (which happens to have a pointless empty line anyway)...
Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
This patch is against the linux-next branch of Trond Myklebust's linux-nfs.git
repo.
fs/nfs/direct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-nfs/fs/nfs/direct.c
===================================================================
--- linux-nfs.orig/fs/nfs/direct.c
+++ linux-nfs/fs/nfs/direct.c
@@ -757,7 +757,6 @@ static void nfs_direct_write_completion(
{
struct nfs_direct_req *dreq = hdr->dreq;
struct nfs_commit_info cinfo;
- struct nfs_page *req = nfs_list_entry(hdr->pages.next);
struct inode *inode = dreq->inode;
int flags = NFS_ODIRECT_DONE;
@@ -786,6 +785,7 @@ static void nfs_direct_write_completion(
spin_unlock(&inode->i_lock);
while (!list_empty(&hdr->pages)) {
+ struct nfs_page *req;
req = nfs_list_entry(hdr->pages.next);
nfs_list_remove_request(req);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfs: direct: drop useless initializer in nfs_direct_write_completion()
2025-04-08 20:53 [PATCH] nfs: direct: drop useless initializer in nfs_direct_write_completion() Sergey Shtylyov
@ 2025-04-09 20:40 ` Sergey Shtylyov
2025-04-11 11:04 ` Benjamin Coddington
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2025-04-09 20:40 UTC (permalink / raw)
To: Anna Schumaker, linux-nfs, Trond Myklebust; +Cc: lvc-project
Hello!
Oops, used an old Trond's email. :-/ Do I need to repost?
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfs: direct: drop useless initializer in nfs_direct_write_completion()
2025-04-08 20:53 [PATCH] nfs: direct: drop useless initializer in nfs_direct_write_completion() Sergey Shtylyov
2025-04-09 20:40 ` Sergey Shtylyov
@ 2025-04-11 11:04 ` Benjamin Coddington
1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Coddington @ 2025-04-11 11:04 UTC (permalink / raw)
To: Sergey Shtylyov; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, lvc-project
On 8 Apr 2025, at 16:53, Sergey Shtylyov wrote:
> In nfs_direct_write_completion(), the local variable req isn't used outside
> the *while* loop and is assigned to right at the start of that loop's body,
> so its initializer appears useless -- drop it; then move the declaration to
> the loop body (which happens to have a pointless empty line anyway)...
>
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Ben
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-11 11:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 20:53 [PATCH] nfs: direct: drop useless initializer in nfs_direct_write_completion() Sergey Shtylyov
2025-04-09 20:40 ` Sergey Shtylyov
2025-04-11 11:04 ` Benjamin Coddington
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox