[rtems commit] sparse-disk: check return value from semaphore_obtain/ release
Gedare Bloom
gedare at rtems.org
Thu Sep 5 19:07:52 UTC 2013
Module: rtems
Branch: master
Commit: 5f040b88294225eab04625274bc6aa3dc68e710d
Changeset: http://git.rtems.org/rtems/commit/?id=5f040b88294225eab04625274bc6aa3dc68e710d
Author: Gedare Bloom <gedare at rtems.org>
Date: Thu Sep 5 14:21:32 2013 -0400
sparse-disk: check return value from semaphore_obtain/release
In case obtain/release is unsuccessful, cause a fatal error.
---
cpukit/libblock/src/sparse-disk.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/cpukit/libblock/src/sparse-disk.c b/cpukit/libblock/src/sparse-disk.c
index 987ab6d..ab6a25d 100644
--- a/cpukit/libblock/src/sparse-disk.c
+++ b/cpukit/libblock/src/sparse-disk.c
@@ -236,8 +236,12 @@ static int sparse_disk_read_write(
uint8_t *buff;
size_t buff_size;
unsigned int bytes_handled;
+ rtems_status_code sc;
- rtems_semaphore_obtain( sparse_disk->mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
+ sc = rtems_semaphore_obtain(sparse_disk->mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+ if (sc != RTEMS_SUCCESSFUL) {
+ rtems_fatal_error_occurred( 0xdeadbeef );
+ }
for ( req_buffer = 0;
( 0 <= rv ) && ( req_buffer < req->bufnum );
@@ -267,7 +271,10 @@ static int sparse_disk_read_write(
}
}
- rtems_semaphore_release( sparse_disk->mutex );
+ sc = rtems_semaphore_release( sparse_disk->mutex );
+ if (sc != RTEMS_SUCCESSFUL) {
+ rtems_fatal_error_occurred( 0xdeadbeef );
+ }
if ( 0 > rv )
rtems_blkdev_request_done( req, RTEMS_IO_ERROR );
More information about the vc
mailing list