On 30.07.2025 00:31, Andrew Cooper wrote:
> MISRA Rule 5.5 objects to a macro aliasing a function, which is what
> pirq_cleanup_check() does.  The macro is an overly-complicated way of writing:
> 
>     if ( !pirq->evtchn )
>         pirq_cleanup_check(pirq, d);

The way you word this does not in any way appreciate the original intention
behind introducing this macro: It wasn't to write something in an overly
complicated form, but to make sure no call site would mistakenly omit the
condition. IOW ...

> There are only a handful of users, so expand it inline to be plain regular C.
> 
> Doing this shows one path now needing braces, and one path in
> evtchn_bind_pirq() where the expanded form simplies back to no delta, as it
> follows an unconditional clear of info->evtchn.

... this one place you don't need to touch is now becoming at least close
to a bad precedent.

The code changes themselves being all fine, the above is not an objection
to the patch. I'd much appreciate if the description was re-worded, though,
to take into account the original intention. And obviously with the original
intention in mind, whether pleasing Misra this way is actually outweighing
the (latent) risk wants (re)considering.

Jan

Reply via email to