linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/6] ubifs: simplify drop_last_node() via list_last_entry_or_null()
@ 2013-11-15  4:33 Jeff Liu
  0 siblings, 0 replies; only message in thread
From: Jeff Liu @ 2013-11-15  4:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, xfs, cluster-devel, linux-mtd, jfs-discussion, oleg, jiri, gregkh

From: Jie Liu <jeff.liu@oracle.com>

Simplify the code in drop_last_node() via list_last_entry_or_null().

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 fs/ubifs/recovery.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 065096e..e46c394 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -603,12 +603,10 @@ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs)
  */
 static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs)
 {
-	struct ubifs_scan_node *snod;
-
-	if (!list_empty(&sleb->nodes)) {
-		snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node,
-				  list);
+	struct ubifs_scan_node *snod = list_last_entry_or_null(&sleb->nodes,
+				       struct ubifs_scan_node, list);
 
+	if (snod) {
 		dbg_rcvry("dropping last node at %d:%d",
 			  sleb->lnum, snod->offs);
 		*offs = snod->offs;
-- 
1.8.3.2

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

only message in thread, other threads:[~2013-11-15  4:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15  4:33 [PATCH 4/6] ubifs: simplify drop_last_node() via list_last_entry_or_null() Jeff Liu

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