On Fri, Jun 12, 2026 at 09:42:12PM +0200, Sasha Finkelstein wrote:
quoted
On Jun 12, 2026, at 21:33, Janne Grunau [off-list ref] wrote:
I think the following is slightly easier to read
{
if (power->bcf0_1byte) {
u8 tval = 0;
int ret = apple_smc_read_u8(power->smc, SMC_KEY(BCF0), &tval);
*val = tval;
return ret;
}
return apple_smc_read_u32(power->smc, SMC_KEY(BCF0), val);
}
I personally prefer using early returns as much as possible, as it makes
it easier for me to read in linear order and due to line length reasons.
But no strong opinion either way.
I don't disagree in general but in this case the code inside the 4 lines
inside the if are not much more complex than the early return. It
limits the scope of the local variables and avois a not on the
condition.
I can live with either version and the strength of my opinion will be
depleted by writing this reply.
Janne