From dtor_core@ameritech.net Fri Apr 29 07:06:43 2005 From: Dmitry Torokhov Subject: sysfs: (driver/base) if show/store is missing return -EIO Date: Fri, 29 Apr 2005 01:23:47 -0500 sysfs: fix drivers/base so if an attribute doesn't implement show or store method read/write will return -EIO instead of 0. Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/base/bus.c | 4 ++-- drivers/base/class.c | 4 ++-- drivers/base/core.c | 4 ++-- drivers/base/sys.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) --- gregkh-2.6.orig/drivers/base/class.c 2005-05-03 22:07:06.000000000 -0700 +++ gregkh-2.6/drivers/base/class.c 2005-05-03 22:07:10.000000000 -0700 @@ -26,7 +26,7 @@ { struct class_attribute * class_attr = to_class_attr(attr); struct class * dc = to_class(kobj); - ssize_t ret = 0; + ssize_t ret = -EIO; if (class_attr->show) ret = class_attr->show(dc, buf); @@ -39,7 +39,7 @@ { struct class_attribute * class_attr = to_class_attr(attr); struct class * dc = to_class(kobj); - ssize_t ret = 0; + ssize_t ret = -EIO; if (class_attr->store) ret = class_attr->store(dc, buf, count); --- gregkh-2.6.orig/drivers/base/sys.c 2005-05-03 22:06:10.000000000 -0700 +++ gregkh-2.6/drivers/base/sys.c 2005-05-03 22:07:10.000000000 -0700 @@ -37,7 +37,7 @@ if (sysdev_attr->show) return sysdev_attr->show(sysdev, buffer); - return 0; + return -EIO; } @@ -50,7 +50,7 @@ if (sysdev_attr->store) return sysdev_attr->store(sysdev, buffer, count); - return 0; + return -EIO; } static struct sysfs_ops sysfs_ops = { --- gregkh-2.6.orig/drivers/base/bus.c 2005-05-03 22:06:15.000000000 -0700 +++ gregkh-2.6/drivers/base/bus.c 2005-05-03 22:07:10.000000000 -0700 @@ -36,7 +36,7 @@ { struct driver_attribute * drv_attr = to_drv_attr(attr); struct device_driver * drv = to_driver(kobj); - ssize_t ret = 0; + ssize_t ret = -EIO; if (drv_attr->show) ret = drv_attr->show(drv, buf); @@ -49,7 +49,7 @@ { struct driver_attribute * drv_attr = to_drv_attr(attr); struct device_driver * drv = to_driver(kobj); - ssize_t ret = 0; + ssize_t ret = -EIO; if (drv_attr->store) ret = drv_attr->store(drv, buf, count); --- gregkh-2.6.orig/drivers/base/core.c 2005-05-03 22:07:06.000000000 -0700 +++ gregkh-2.6/drivers/base/core.c 2005-05-03 22:07:10.000000000 -0700 @@ -38,7 +38,7 @@ { struct device_attribute * dev_attr = to_dev_attr(attr); struct device * dev = to_dev(kobj); - ssize_t ret = 0; + ssize_t ret = -EIO; if (dev_attr->show) ret = dev_attr->show(dev, buf); @@ -51,7 +51,7 @@ { struct device_attribute * dev_attr = to_dev_attr(attr); struct device * dev = to_dev(kobj); - ssize_t ret = 0; + ssize_t ret = -EIO; if (dev_attr->store) ret = dev_attr->store(dev, buf, count);