Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1481782 > unrolled thread
| Started by | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| First post | 2016-09-12 20:20 +0200 |
| Last post | 2016-09-13 08:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] s390: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-12 20:20 +0200
Re: [PATCH] s390: cleanup with list_first_entry_or_null() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-09-13 08:50 +0200
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-09-12 20:20 +0200 |
| Subject | [PATCH] s390: cleanup with list_first_entry_or_null() |
| Message-ID | <sgDZL-6Vq-3@gated-at.bofh.it> |
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(-)
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);
}
/*
--
1.9.1
[toc] | [next] | [standalone]
| From | Heiko Carstens <heiko.carstens@de.ibm.com> |
|---|---|
| Date | 2016-09-13 08:50 +0200 |
| Message-ID | <sgPHz-6Bw-3@gated-at.bofh.it> |
| In reply to | #1481782 |
On Tue, Sep 13, 2016 at 03:10:39AM +0900, Masahiro Yamada wrote:
> 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(-)
>
> 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);
Applied, however without the line break in order to improve readability.
Thanks!
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web