Skip to content

Commit

Permalink
sysfs: return proper error code
Browse files Browse the repository at this point in the history
  • Loading branch information
moodyhunter committed Dec 10, 2023
1 parent c059202 commit f9bd775
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/filesystem/sysfs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ static ssize_t sysfs_fops_read(const file_t *file, void *buf, size_t size, off_t
{
sysfs_file_t *f = file->dentry->inode->private;
if (f->item->type != SYSFS_RO && f->item->type != SYSFS_RW)
return -1;
return -ENOTSUP;

if (!sysfs_file_ensure_ready(file))
return -1;
return -ETXTBSY;

if (offset >= f->buf_head_offset)
return 0;
Expand All @@ -167,7 +167,7 @@ static ssize_t sysfs_fops_write(const file_t *file, const void *buf, size_t size
{
sysfs_file_t *f = file->dentry->inode->private;
if (f->item->type != SYSFS_WO && f->item->type != SYSFS_RW)
return -1;
return -ENOTSUP;
return f->item->store(f, buf, size, offset);
}

Expand Down

0 comments on commit f9bd775

Please sign in to comment.