]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfs: direct: drop useless initializer in nfs_direct_write_completion()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Tue, 8 Apr 2025 20:53:42 +0000 (23:53 +0300)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Apr 2025 03:25:44 +0000 (23:25 -0400)
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>
Link: https://lore.kernel.org/r/416219f5-7983-484b-b5a7-5fb7da9561f7@omp.ru
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/direct.c

index f32f8d7c9122bf14852abd68a8f46c7409d185b6..48d89716193a7ed1c0033fb093d4fa9d5a099139 100644 (file)
@@ -757,7 +757,6 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
 {
        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(struct nfs_pgio_header *hdr)
        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);