fs/procfs: call the close of each component when procfs_close
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
37fc0a0208
commit
1cc67b68f2
|
@ -421,6 +421,7 @@ static int procfs_open(FAR struct file *filep, FAR const char *relpath,
|
||||||
static int procfs_close(FAR struct file *filep)
|
static int procfs_close(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
FAR struct procfs_file_s *attr;
|
FAR struct procfs_file_s *attr;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
/* Recover our private data from the struct file instance */
|
/* Recover our private data from the struct file instance */
|
||||||
|
|
||||||
|
@ -429,9 +430,17 @@ static int procfs_close(FAR struct file *filep)
|
||||||
|
|
||||||
/* Release the file attributes structure */
|
/* Release the file attributes structure */
|
||||||
|
|
||||||
kmm_free(attr);
|
if (attr->procfsentry->ops->close != NULL)
|
||||||
|
{
|
||||||
|
ret = attr->procfsentry->ops->close(filep);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kmm_free(attr);
|
||||||
|
}
|
||||||
|
|
||||||
filep->f_priv = NULL;
|
filep->f_priv = NULL;
|
||||||
return OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue