summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/regiongetfreeinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems/src/regiongetfreeinfo.c')
-rw-r--r--cpukit/rtems/src/regiongetfreeinfo.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/cpukit/rtems/src/regiongetfreeinfo.c b/cpukit/rtems/src/regiongetfreeinfo.c
index 3ad06374fb..2346b5e7c4 100644
--- a/cpukit/rtems/src/regiongetfreeinfo.c
+++ b/cpukit/rtems/src/regiongetfreeinfo.c
@@ -49,36 +49,39 @@ rtems_status_code rtems_region_get_free_information(
Heap_Information_block *the_info
)
{
- register Region_Control *the_region;
Objects_Locations location;
+ rtems_status_code return_status = RTEMS_INTERNAL_ERROR;
+ register Region_Control *the_region;
if ( !the_info )
return RTEMS_INVALID_ADDRESS;
_RTEMS_Lock_allocator();
- the_region = _Region_Get( id, &location );
- switch ( location ) {
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* this error cannot be returned */
- _RTEMS_Unlock_allocator();
- return RTEMS_INTERNAL_ERROR;
-#endif
- case OBJECTS_ERROR:
- _RTEMS_Unlock_allocator();
- return RTEMS_INVALID_ID;
+ the_region = _Region_Get( id, &location );
+ switch ( location ) {
- case OBJECTS_LOCAL:
+ case OBJECTS_LOCAL:
- the_info->Used.number = 0;
- the_info->Used.total = 0;
- the_info->Used.largest = 0;
+ the_info->Used.number = 0;
+ the_info->Used.total = 0;
+ the_info->Used.largest = 0;
- _Heap_Get_free_information( &the_region->Memory, &the_info->Free );
+ _Heap_Get_free_information( &the_region->Memory, &the_info->Free );
+
+ return_status = RTEMS_SUCCESSFUL;
+ break;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ break;
+#endif
- _RTEMS_Unlock_allocator();
- return RTEMS_SUCCESSFUL;
- }
+ case OBJECTS_ERROR:
+ return_status = RTEMS_INVALID_ID;
+ break;
+ }
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+ _RTEMS_Unlock_allocator();
+ return return_status;
}