The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: LongWei27 <longwei27@huawei.com>
Cc: Alexander Graf <graf@amazon.com>, Mike Rapoport <rppt@kernel.org>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	kexec@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, hewenliang4@huawei.com
Subject: Re: [PATCH V2] kho: Convert error handling to immediate return pattern
Date: Mon, 24 Aug 2026 03:54:18 +0100	[thread overview]
Message-ID: <aouyWs39qxGI7CP0@casper.infradead.org> (raw)
In-Reply-To: <20260824024448.550552-1-longwei27@huawei.com>

On Mon, Aug 24, 2026 at 10:44:48AM +0800, LongWei27 wrote:
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -1438,20 +1438,34 @@ static __init int kho_out_fdt_setup(void)
>  	int err;
>  
>  	err = fdt_create(root, PAGE_SIZE);
> -	err |= fdt_finish_reservemap(root);
> -	err |= fdt_begin_node(root, "");
> -	err |= fdt_property_string(root, "compatible", KHO_FDT_COMPATIBLE);
> +	if (err)
> +		return err;
> +	err = fdt_finish_reservemap(root);
> +	if (err)
> +		return err;
> +	err = fdt_begin_node(root, "");
> +	if (err)
> +		return err;
> +	err = fdt_property_string(root, "compatible", KHO_FDT_COMPATIBLE);
> +	if (err)
> +		return err;

Less verbose:

 	err = fdt_create(root, PAGE_SIZE);
-	err |= fdt_finish_reservemap(root);
-	err |= fdt_begin_node(root, "");
-	err |= fdt_property_string(root, "compatible", KHO_FDT_COMPATIBLE);
+	if (!err)
+		err = fdt_finish_reservemap(root);
+	if (!err)
+		err = fdt_begin_node(root, "");
+	if (!err)
+		err = fdt_property_string(root, "compatible",
+				KHO_FDT_COMPATIBLE);

up to the maintainer which one they prefer ...

  reply	other threads:[~2026-08-24  2:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <00c96a62-f783-497c-a7ac-1de495e4af06@huawei.com>
2026-08-24  2:44 ` [PATCH V2] kho: Convert error handling to immediate return pattern LongWei27
2026-08-24  2:54   ` Matthew Wilcox [this message]
2026-08-24  6:34     ` longwei (I)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aouyWs39qxGI7CP0@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=graf@amazon.com \
    --cc=hewenliang4@huawei.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longwei27@huawei.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox