[PATCH v2] cpukit/cache: Report coherent add area failures

Kinsey Moore kinsey.moore at oarcorp.com
Thu Jan 25 20:22:35 UTC 2024


On Thu, Jan 25, 2024 at 1:04 PM Sebastian Huber <
sebastian.huber at embedded-brains.de> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240125/b4a2cfa1/attachment.htm>


More information about the devel mailing list