fs/procfs: call the close of each component when procfs_close

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2023-06-05 18:09:04 +08:00 committed by Xiang Xiao
parent 37fc0a0208
commit 1cc67b68f2
1 changed files with 11 additions and 2 deletions

View File

@ -421,6 +421,7 @@ static int procfs_open(FAR struct file *filep, FAR const char *relpath,
static int procfs_close(FAR struct file *filep)
{
FAR struct procfs_file_s *attr;
int ret = OK;
/* 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 */
if (attr->procfsentry->ops->close != NULL)
{
ret = attr->procfsentry->ops->close(filep);
}
else
{
kmm_free(attr);
}
filep->f_priv = NULL;
return OK;
return ret;
}
/****************************************************************************