fs/inode: remove unnecessary return value for inode_addrefs
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
09a9611ae9
commit
b2e69b86ad
|
@ -41,12 +41,10 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int inode_addref(FAR struct inode *inode)
|
||||
void inode_addref(FAR struct inode *inode)
|
||||
{
|
||||
if (inode)
|
||||
{
|
||||
atomic_fetch_add(&inode->i_crefs, 1);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ int inode_remove(FAR const char *path);
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int inode_addref(FAR struct inode *inode);
|
||||
void inode_addref(FAR struct inode *inode);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inode_release
|
||||
|
|
|
@ -350,24 +350,17 @@ static int shmfs_mmap(FAR struct file *filep,
|
|||
|
||||
/* Keep the inode when mmapped, increase refcount */
|
||||
|
||||
ret = inode_addref(filep->f_inode);
|
||||
if (ret >= 0)
|
||||
inode_addref(filep->f_inode);
|
||||
object = filep->f_inode->i_private;
|
||||
if (object)
|
||||
{
|
||||
object = filep->f_inode->i_private;
|
||||
if (object)
|
||||
{
|
||||
ret = shmfs_map_object(object, &entry->vaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
ret = shmfs_map_object(object, &entry->vaddr);
|
||||
}
|
||||
|
||||
if (ret < 0 ||
|
||||
(ret = shmfs_add_map(entry, filep->f_inode)) < 0)
|
||||
{
|
||||
inode_release(filep->f_inode);
|
||||
}
|
||||
if (ret < 0 ||
|
||||
(ret = shmfs_add_map(entry, filep->f_inode)) < 0)
|
||||
{
|
||||
inode_release(filep->f_inode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -78,11 +78,7 @@ int file_dup3(FAR struct file *filep1, FAR struct file *filep2, int flags)
|
|||
/* Increment the reference count on the contained inode */
|
||||
|
||||
inode = filep1->f_inode;
|
||||
ret = inode_addref(inode);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
inode_addref(inode);
|
||||
|
||||
/* If there is already an inode contained in the new file structure,
|
||||
* close the file and release the inode.
|
||||
|
|
|
@ -314,29 +314,23 @@ static int pseudofile_mmap(FAR struct file *filep,
|
|||
{
|
||||
FAR struct inode *node = filep->f_inode;
|
||||
FAR struct fs_pseudofile_s *pf = node->i_private;
|
||||
int ret = -EINVAL;
|
||||
|
||||
/* Keep the inode when mmapped, increase refcount */
|
||||
|
||||
int ret = inode_addref(node);
|
||||
if (ret >= 0)
|
||||
inode_addref(node);
|
||||
if (map->offset >= 0 && map->offset < node->i_size &&
|
||||
map->length != 0 && map->offset + map->length <= node->i_size)
|
||||
{
|
||||
if (map->offset >= 0 && map->offset < node->i_size &&
|
||||
map->length != 0 && map->offset + map->length <= node->i_size)
|
||||
{
|
||||
map->vaddr = pf->content + map->offset;
|
||||
map->munmap = pseudofile_munmap;
|
||||
map->priv.p = (FAR void *)node;
|
||||
ret = mm_map_add(get_current_mm(), map);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
map->vaddr = pf->content + map->offset;
|
||||
map->munmap = pseudofile_munmap;
|
||||
map->priv.p = (FAR void *)node;
|
||||
ret = mm_map_add(get_current_mm(), map);
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
inode_release(node);
|
||||
}
|
||||
if (ret < 0)
|
||||
{
|
||||
inode_release(node);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue