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

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jan 25 19:04:14 UTC 2024


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.

-- 
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list