diff mbox

s390: cleanup with list_first_entry_or_null()

Message ID 1473703839-1185-1-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit f296190e41ee1e1e6912f0ddae09b28e9cfae48d
Headers show

Commit Message

Masahiro Yamada Sept. 12, 2016, 6:10 p.m. UTC
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 arch/s390/kernel/crash_dump.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

-- 
1.9.1
diff mbox

Patch

diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 29df848..621907d 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -71,9 +71,8 @@  struct save_area * __init save_area_alloc(bool is_boot_cpu)
  */
 struct save_area * __init save_area_boot_cpu(void)
 {
-	if (list_empty(&dump_save_areas))
-		return NULL;
-	return list_first_entry(&dump_save_areas, struct save_area, list);
+	return list_first_entry_or_null(&dump_save_areas, struct save_area,
+					list);
 }
 
 /*