Re: [PATCH v2a 4/6] x86/microcode/intel: Implement staging handler
From: Chang S. Bae
Date: Wed Mar 26 2025 - 14:44:22 EST
On 3/26/2025 1:34 AM, Chao Gao wrote:
+
+ /* Reset tracking variables */
+ ss->offset = 0;
+ ss->bytes_sent = 0;
Nit: no need to reset them, as
+ struct staging_state ss = {};
in do_stage() will zero the whole structure.
I initially wanted to explicitly highlight where these variables are
reset, but you’re right — in practice, they can be removed.
why send_data_chunk() and fetch_next_offset() return a boolean instead of
an error or ucode_state?
Using the return value to indicate just success or failure, while relying
on another variable to report detailed error/state, seems a bit clumsy to
me.
The error state is interpreted at the call site, where the final result
is returned to the caller.
At the end of each step, all the loop needs to decide is whether to
continue or break, which naturally fits a boolean return. I don’t see a
strong reason to change this approach.
Thanks,
Chang