On Thu, Jan 25, 2024 at 1:04 PM Sebastian Huber <
[email protected]> wrote:
> On 25.01.24 16:00, Kinsey Moore wrote:
> > -void rtems_cache_coherent_add_area(
> > +rtems_status_code rtems_cache_coherent_add_area(
> > void *area_begin,
> > uintptr_t area_size
> > )
> > {
> > + rtems_status_code sc;
> > +
> > if ( _System_state_Is_up( _System_state_Get()) ) {
> > _RTEMS_Lock_allocator();
> > + }
> >
> > - add_area( area_begin, area_size );
> > + sc = add_area( area_begin, area_size );
> >
> > + if ( _System_state_Is_up( _System_state_Get()) ) {
> > _RTEMS_Unlock_allocator();
> > - } else {
> > - add_area( area_begin, area_size );
> > }
> > +
> > + return sc;
> > }
>
> When I would be a static analyzer knowing that _RTEMS_Lock_allocator()
> acquires a mutex and _RTEMS_Unlock_allocator() releases a mutex, then I
> would complain about the changed code since a considerable amount of
> reasoning is required to proof that the second if will take the same
> branch as the first if.
>
I'll pull those calls out into a local variable.
Kinsey
_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel