summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-13 10:01:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-13 10:01:51 +0200
commitb22ff7827917318db640834ef3f7dee073302ed9 (patch)
treebc117325914bcb58c2fa25aaa629150e06624ba8
parentMerge branch 'upstream' (diff)
downloadrtems-b22ff7827917318db640834ef3f7dee073302ed9.tar.bz2
Filesystem: Remove NULL pointer check
-rw-r--r--cpukit/libfs/src/pipe/fifo.c31
-rw-r--r--testsuites/sptests/spfifo04/init.c12
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 );