From: "longwei (I)" <longwei27@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
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 14:34:12 +0800 [thread overview]
Message-ID: <e1c2d008-9490-4b68-924f-dcc45a84f369@huawei.com> (raw)
In-Reply-To: <aouyWs39qxGI7CP0@casper.infradead.org>
Hi Matthew,
Thanks for the review.
I chose the explicit `if (err) return err` pattern for clarity and
"fail fast" behavior. However, I'm happy to adopt the chained pattern
if the maintainer prefers it.
Thanks,
Long Wei
在 2026/8/24 10:54, Matthew Wilcox 写道:
> 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 ...
prev parent reply other threads:[~2026-08-24 6:34 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
2026-08-24 6:34 ` longwei (I) [this message]
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=e1c2d008-9490-4b68-924f-dcc45a84f369@huawei.com \
--to=longwei27@huawei.com \
--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=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=willy@infradead.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