[PATCH] arm64: Refactor conditional logic

Hardevsinh Palaniya hardevsinh.palaniya at siliconsignals.io
Mon Nov 11 07:25:18 PST 2024


Hi Mark,

Thanks for the input

> > @@ -989,7 +989,7 @@ static void init_cpu_ftr_reg(u32 sys_reg, u64 new)
> >                                /* Override was valid */
> >                                ftr_new = tmp;
> >                                str = "forced";
> > -                     } else if (ftr_ovr == tmp) {
> > +                     } else {
> >                                /* Override was the safe value */
> >                                str = "already set";
> >                        }
>
> Your changelog wasn't very clear on this but the tests in this if/else
> tree are
>
>                       if (ftr_ovr != tmp) {
>                        } else if (ftr_new != tmp) {
>                        } else if (ftr_ovr == tmp) {
>                        }
>
> so your analysis is accurate, the first and last tests are the inverse
> of each other so onr must be true.  This should be clear from your
> commit log.  Also all of those branches set "str" and we then
> immediately test
>
>                        if (str)
>
> before logging a diagnostic.  If we're looking to reduce unneeded tests
> then either that one is redundant too or there's another bug in the
> logic (I think from a quick scan just the former).

Yes, I agree

that also we can remove 

Best Regards,
Hardev


More information about the linux-arm-kernel mailing list