From 89a863031f2f29a1892822efa3ec2cb60ae86dfd Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 26 Jul 2008 20:40:49 +0000 Subject: Fix FIFO interlock errors git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@784 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/drivers/pipe-common.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'nuttx/drivers/pipe-common.c') 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; } -- cgit v1.2.3