[PATCH v2] power: supply: macsmc: Support macOS 27 SMC firmware

Janne Grunau j at jannau.net
Fri Jun 12 12:56:27 PDT 2026


On Fri, Jun 12, 2026 at 09:42:12PM +0200, Sasha Finkelstein wrote:
> 
> > On Jun 12, 2026, at 21:33, Janne Grunau <j at jannau.net> 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



More information about the linux-arm-kernel mailing list