[PATCH V2] kho: Convert error handling to immediate return pattern

longwei (I) longwei27 at huawei.com
Mon Aug 31 04:58:35 PDT 2026


Hi Mike Rapoport,

Thanks for the review.
To be honest, I haven't observed any actual failures in this path in our production environment.
This change was identified during our internal team code review—the err |= func() pattern looked concerning to us at first glance, so we attempted to clean it up.

However, I agree with your assessment: the caller doesn't care about the exact error value, libfdt uses its own error codes, and this is a cold path where failures are unlikely. The change is indeed unnecessary churn without a concrete bug to fix.

I'll drop this patch. Please ignore this submission.

Thanks,
Long Wei

在 2026/8/31 19:28, Mike Rapoport 写道:
> Hi,
> 
> 
>> Replace the chained error accumulation (err |= func()) with immediate
>> per-step error checking and early return in kho_out_fdt_setup().
>>
>> Two problems with the current approach:
>> 1. It continues executing FDT operations even after a failure, which
>>    is pointless and potentially unsafe on an invalid FDT context.
> 
> Did you actually see failures here or was it an LLM suggesting that they
> may happen?
> 
>> 2. Bitwise OR of multiple negative error codes produces a result that
>>    may not represent any actual error, making debugging misleading.
>>
>> Early return fails fast and preserves the original error code for
>> accurate diagnosis.
> 
> The caller does not care about the exact error value, so the diagnosis
> statement is moot at best.
> Moreover, libfdt does not return Linux error values.
> 




More information about the kexec mailing list