Check return from nxsem_wait_uninterruptible

This commit is only for those files under drivers/1wire, drivers/bch,
drivers/can and drivers/mmcsd.
This commit is contained in:
Ouss4
2020-03-31 22:19:07 +01:00
committed by patacongo
parent 986e594563
commit 997d4fabb0
9 changed files with 355 additions and 109 deletions
+42 -7
View File
@@ -140,7 +140,12 @@ static int bch_open(FAR struct file *filep)
/* Increment the reference count */
bchlib_semtake(bch);
ret = bchlib_semtake(bch);
if (ret < 0)
{
return ret;
}
if (bch->refs == MAX_OPENCNT)
{
ret = -EMFILE;
@@ -170,9 +175,16 @@ static int bch_close(FAR struct file *filep)
DEBUGASSERT(inode && inode->i_private);
bch = (FAR struct bchlib_s *)inode->i_private;
/* Get exclusive access */
ret = bchlib_semtake(bch);
if (ret < 0)
{
return ret;
}
/* Flush any dirty pages remaining in the cache */
bchlib_semtake(bch);
bchlib_flushsector(bch);
/* Decrement the reference count (I don't use bchlib_decref() because I
@@ -231,7 +243,11 @@ static off_t bch_seek(FAR struct file *filep, off_t offset, int whence)
DEBUGASSERT(inode && inode->i_private);
bch = (FAR struct bchlib_s *)inode->i_private;
bchlib_semtake(bch);
ret = bchlib_semtake(bch);
if (ret < 0)
{
return (off_t)ret;
}
/* Determine the new, requested file position */
@@ -298,7 +314,12 @@ static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, size_t len)
DEBUGASSERT(inode && inode->i_private);
bch = (FAR struct bchlib_s *)inode->i_private;
bchlib_semtake(bch);
ret = bchlib_semtake(bch);
if (ret < 0)
{
return (ssize_t)ret;
}
ret = bchlib_read(bch, buffer, filep->f_pos, len);
if (ret > 0)
{
@@ -325,7 +346,12 @@ static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer,
if (!bch->readonly)
{
bchlib_semtake(bch);
ret = bchlib_semtake(bch);
if (ret < 0)
{
return (ssize_t)ret;
}
ret = bchlib_write(bch, buffer, filep->f_pos, len);
if (ret > 0)
{
@@ -366,7 +392,12 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct bchlib_s **bchr =
(FAR struct bchlib_s **)((uintptr_t)arg);
bchlib_semtake(bch);
ret = bchlib_semtake(bch);
if (ret < 0)
{
return ret;
}
if (!bchr || bch->refs == MAX_OPENCNT)
{
ret = -EINVAL;
@@ -454,7 +485,11 @@ static int bch_unlink(FAR struct inode *inode)
/* Get exclusive access to the BCH device */
bchlib_semtake(bch);
ret = bchlib_semtake(bch);
if (ret < 0)
{
return ret;
}
/* Indicate that the driver has been unlinked */