<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 25, 2024 at 1:04 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 25.01.24 16:00, Kinsey Moore wrote:<br>
> -void rtems_cache_coherent_add_area(<br>
> +rtems_status_code rtems_cache_coherent_add_area(<br>
> void *area_begin,<br>
> uintptr_t area_size<br>
> )<br>
> {<br>
> + rtems_status_code sc;<br>
> +<br>
> if ( _System_state_Is_up( _System_state_Get()) ) {<br>
> _RTEMS_Lock_allocator();<br>
> + }<br>
> <br>
> - add_area( area_begin, area_size );<br>
> + sc = add_area( area_begin, area_size );<br>
> <br>
> + if ( _System_state_Is_up( _System_state_Get()) ) {<br>
> _RTEMS_Unlock_allocator();<br>
> - } else {<br>
> - add_area( area_begin, area_size );<br>
> }<br>
> +<br>
> + return sc;<br>
> }<br>
<br>
When I would be a static analyzer knowing that _RTEMS_Lock_allocator() <br>
acquires a mutex and _RTEMS_Unlock_allocator() releases a mutex, then I <br>
would complain about the changed code since a considerable amount of <br>
reasoning is required to proof that the second if will take the same <br>
branch as the first if.<br></blockquote><div><br></div><div>I'll pull those calls out into a local variable.</div><div><br></div><div>Kinsey <br></div></div></div>