From dtor_core@ameritech.net Fri Apr 29 07:06:42 2005 From: Dmitry Torokhov Subject: sysfs: if show/store is missing return -EIO Date: Fri, 29 Apr 2005 01:22:00 -0500 sysfs: if attribute does not implement show or store method read/write should return -EIO instead of 0 or -EINVAL. Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/bin.c | 4 ++-- fs/sysfs/file.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- gregkh-2.6.orig/fs/sysfs/file.c 2005-05-03 22:05:01.000000000 -0700 +++ gregkh-2.6/fs/sysfs/file.c 2005-05-03 22:05:03.000000000 -0700 @@ -23,7 +23,7 @@ { struct subsystem * s = to_subsys(kobj); struct subsys_attribute * sattr = to_sattr(attr); - ssize_t ret = 0; + ssize_t ret = -EIO; if (sattr->show) ret = sattr->show(s,page); @@ -36,7 +36,7 @@ { struct subsystem * s = to_subsys(kobj); struct subsys_attribute * sattr = to_sattr(attr); - ssize_t ret = 0; + ssize_t ret = -EIO; if (sattr->store) ret = sattr->store(s,page,count); --- gregkh-2.6.orig/fs/sysfs/bin.c 2005-05-03 22:05:01.000000000 -0700 +++ gregkh-2.6/fs/sysfs/bin.c 2005-05-03 22:05:03.000000000 -0700 @@ -25,7 +25,7 @@ struct kobject * kobj = to_kobj(dentry->d_parent); if (!attr->read) - return -EINVAL; + return -EIO; return attr->read(kobj, buffer, off, count); } @@ -71,7 +71,7 @@ struct kobject *kobj = to_kobj(dentry->d_parent); if (!attr->write) - return -EINVAL; + return -EIO; return attr->write(kobj, buffer, offset, count); }