public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gfs2: Set error on error path
@ 2023-09-29  6:14 Deepak R Varma
  2023-09-29  7:14 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Deepak R Varma @ 2023-09-29  6:14 UTC (permalink / raw)
  To: Bob Peterson, Andreas Gruenbacher, gfs2, linux-kernel
  Cc: linux-kernel-mentees, Dan Carpenter, Deepak R Varma

Set the error variable inside the error path on failure. Saves
unnecessary variable assignment during normal execution.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 fs/gfs2/bmap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index ef7017fb6951..93bd8ea34444 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -162,9 +162,10 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip)
 
 	down_write(&ip->i_rw_mutex);
 	page = grab_cache_page(inode->i_mapping, 0);
-	error = -ENOMEM;
-	if (!page)
+	if (!page) {
+		error = -ENOMEM;
 		goto out;
+	}
 	error = __gfs2_unstuff_inode(ip, page);
 	unlock_page(page);
 	put_page(page);
-- 
2.39.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-29  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-29  6:14 [PATCH] gfs2: Set error on error path Deepak R Varma
2023-09-29  7:14 ` Dan Carpenter
2023-09-29  7:32   ` drv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox