From b22ff7827917318db640834ef3f7dee073302ed9 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 13 Apr 2012 10:01:51 +0200 Subject: Filesystem: Remove NULL pointer check --- cpukit/libfs/src/pipe/fifo.c | 31 +++++++++++++++---------------- testsuites/sptests/spfifo04/init.c | 12 +----------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c index 31ccfc8193..ca33f6aadb 100644 --- a/cpukit/libfs/src/pipe/fifo.c +++ b/cpukit/libfs/src/pipe/fifo.c @@ -622,24 +622,23 @@ int pipe_ioctl( { int rv = 0; - if (buffer != NULL) { - if (PIPE_LOCK(pipe)) { - switch (cmd) { - case RTEMS_IOCTL_SELECT: - rv = pipe_select(pipe, buffer); - break; - case FIONREAD: - /* Return length of pipe */ - *(unsigned int *) buffer = pipe->Length; - break; - } - - PIPE_UNLOCK(pipe); - } else { - rv = -EINTR; + if (PIPE_LOCK(pipe)) { + switch (cmd) { + case RTEMS_IOCTL_SELECT: + rv = pipe_select(pipe, buffer); + break; + case FIONREAD: + /* Return length of pipe */ + *(unsigned int *) buffer = pipe->Length; + break; + default: + rv = -EINVAL; + break; } + + PIPE_UNLOCK(pipe); } else { - rv = -EFAULT; + rv = -EINTR; } return rv; diff --git a/testsuites/sptests/spfifo04/init.c b/testsuites/sptests/spfifo04/init.c index 628d9808a5..2a3ac46d24 100644 --- a/testsuites/sptests/spfifo04/init.c +++ b/testsuites/sptests/spfifo04/init.c @@ -52,11 +52,6 @@ rtems_task Init( rtems_test_assert( offset == -1 ); rtems_test_assert( errno == ESPIPE ); - puts( "Init - ioctl: FIONBIO -- Expected EFAULT" ); - status = ioctl( fd, FIONBIO, NULL ); - rtems_test_assert( status == -1 ); - rtems_test_assert( errno == EFAULT ); - puts( "Init - ioctl: FIONBIO -- OK" ); status = ioctl( fd, FIONBIO, &flag ); rtems_test_assert( status == 0 ); @@ -67,15 +62,10 @@ rtems_task Init( rtems_test_assert( status == 0 ); puts( "Init - ioctl: Dummy Command -- Expected EINVAL" ); - status = ioctl( fd, -1, NULL ); + status = ioctl( fd, -1 ); rtems_test_assert( status == -1 ); rtems_test_assert( errno == EINVAL ); - puts( "Init - ioctl: FIONREAD -- Expected EFAULT" ); - status = ioctl( fd, FIONREAD, NULL ); - rtems_test_assert( status == -1 ); - rtems_test_assert( errno == EFAULT ); - puts( "Init - ioctl: FIONREAD -- OK" ); status = ioctl( fd, FIONREAD, &pipe_length ); rtems_test_assert( status == 0 ); -- cgit v1.2.3