summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/src/bdbuf.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-01-19 23:54:17 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-01-19 23:54:17 +0000
commita518defe922c91dc2af9f51e3694963364c247a9 (patch)
treeb1d187f8fc0dba1d3e8e5b8a9fadf6b1bc95c58d /cpukit/libblock/src/bdbuf.c
parent2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-a518defe922c91dc2af9f51e3694963364c247a9.tar.bz2
2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com>
Coverity Id 10 * libblock/src/bdbuf.c: Rework loop conditional to avoid potential use of NULL pointer.
Diffstat (limited to 'cpukit/libblock/src/bdbuf.c')
-rw-r--r--cpukit/libblock/src/bdbuf.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index 2282f24417..056a7c8ec2 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -2253,6 +2253,7 @@ rtems_bdbuf_null_disk_ioctl (rtems_disk_device *dd, uint32_t req, void *arg)
static void
rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer)
{
+ rtems_chain_node *node;
static rtems_disk_device null_disk = {
.capabilities = 0,
.ioctl = rtems_bdbuf_null_disk_ioctl
@@ -2301,12 +2302,10 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer)
transfer->write_req->status = RTEMS_RESOURCE_IN_USE;
transfer->write_req->bufnum = 0;
- while (!rtems_chain_is_empty (&transfer->bds))
+ while ((node = rtems_chain_get(&transfer->bds)) != NULL)
{
- rtems_bdbuf_buffer* bd =
- (rtems_bdbuf_buffer*) rtems_chain_get (&transfer->bds);
-
- bool write = false;
+ rtems_bdbuf_buffer* bd = (rtems_bdbuf_buffer*) node;
+ bool write = false;
/*
* If the device only accepts sequential buffers and this is not the