summaryrefslogtreecommitdiff
path: root/nuttx/drivers/pipe-common.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-07-26 20:40:49 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-07-26 20:40:49 +0000
commit89a863031f2f29a1892822efa3ec2cb60ae86dfd (patch)
tree7c57b2cb86b23cce1c4d8e4c39ca4c4927169fba /nuttx/drivers/pipe-common.c
parent5b91c3640ab3973766e320176cf0b3c467209449 (diff)
downloadpx4-nuttx-89a863031f2f29a1892822efa3ec2cb60ae86dfd.tar.gz
px4-nuttx-89a863031f2f29a1892822efa3ec2cb60ae86dfd.tar.bz2
px4-nuttx-89a863031f2f29a1892822efa3ec2cb60ae86dfd.zip
Fix FIFO interlock errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@784 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/pipe-common.c')
-rw-r--r--nuttx/drivers/pipe-common.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/nuttx/drivers/pipe-common.c b/nuttx/drivers/pipe-common.c
index ab6b7d380..f25ef010e 100644
--- a/nuttx/drivers/pipe-common.c
+++ b/nuttx/drivers/pipe-common.c
@@ -124,7 +124,7 @@ FAR struct pipe_dev_s *pipecommon_allocdev(void)
/****************************************************************************
* Name: pipecommon_freedev
****************************************************************************/
-void pipecommon_freedev(FAR struct pipe_dev_s *dev)
+ void pipecommon_freedev(FAR struct pipe_dev_s *dev)
{
sem_destroy(&dev->s.d_bfsem);
sem_destroy(&dev->s.d_rdsem);
@@ -178,7 +178,7 @@ int pipecommon_open(FAR struct file *filep)
sched_lock();
(void)sem_post(&dev->s.d_bfsem);
- if ((filep->f_oflags & O_RDWR) != O_RDONLY && dev->s.d_nwriters < 1)
+ if ((filep->f_oflags & O_RDWR) == O_RDONLY && dev->s.d_nwriters < 1)
{
/* NOTE: d_rdsem is normally used when the read logic waits for more
* data to be written. But until the first writer has opened the
@@ -245,19 +245,9 @@ int pipecommon_close(FAR struct file *filep)
}
}
}
- sem_post(&dev->s.d_bfsem);
}
- else
- {
- /* Then nothing else can be holding the semaphore, so it is save to */
-
- inode->i_private = NULL;
- sem_post(&dev->s.d_bfsem);
-
- /* Then free the pipe structure instance */
- pipecommon_freedev(dev);
- }
+ sem_post(&dev->s.d_bfsem);
return OK;
}