Commit 6c1852a0 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

[PATCH] sysfs: (driver/block) if show/store is missing return -EIO

sysfs: fix drivers/block so if an attribute doesn't implement
       show or store method read/write will return -EIO
       instead of 0 or -EINVAL.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fc7e4828
...@@ -2044,7 +2044,7 @@ as_attr_show(struct kobject *kobj, struct attribute *attr, char *page) ...@@ -2044,7 +2044,7 @@ as_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
struct as_fs_entry *entry = to_as(attr); struct as_fs_entry *entry = to_as(attr);
if (!entry->show) if (!entry->show)
return 0; return -EIO;
return entry->show(e->elevator_data, page); return entry->show(e->elevator_data, page);
} }
...@@ -2057,7 +2057,7 @@ as_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -2057,7 +2057,7 @@ as_attr_store(struct kobject *kobj, struct attribute *attr,
struct as_fs_entry *entry = to_as(attr); struct as_fs_entry *entry = to_as(attr);
if (!entry->store) if (!entry->store)
return -EINVAL; return -EIO;
return entry->store(e->elevator_data, page, length); return entry->store(e->elevator_data, page, length);
} }
......
...@@ -1775,7 +1775,7 @@ cfq_attr_show(struct kobject *kobj, struct attribute *attr, char *page) ...@@ -1775,7 +1775,7 @@ cfq_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
struct cfq_fs_entry *entry = to_cfq(attr); struct cfq_fs_entry *entry = to_cfq(attr);
if (!entry->show) if (!entry->show)
return 0; return -EIO;
return entry->show(e->elevator_data, page); return entry->show(e->elevator_data, page);
} }
...@@ -1788,7 +1788,7 @@ cfq_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -1788,7 +1788,7 @@ cfq_attr_store(struct kobject *kobj, struct attribute *attr,
struct cfq_fs_entry *entry = to_cfq(attr); struct cfq_fs_entry *entry = to_cfq(attr);
if (!entry->store) if (!entry->store)
return -EINVAL; return -EIO;
return entry->store(e->elevator_data, page, length); return entry->store(e->elevator_data, page, length);
} }
......
...@@ -886,7 +886,7 @@ deadline_attr_show(struct kobject *kobj, struct attribute *attr, char *page) ...@@ -886,7 +886,7 @@ deadline_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
struct deadline_fs_entry *entry = to_deadline(attr); struct deadline_fs_entry *entry = to_deadline(attr);
if (!entry->show) if (!entry->show)
return 0; return -EIO;
return entry->show(e->elevator_data, page); return entry->show(e->elevator_data, page);
} }
...@@ -899,7 +899,7 @@ deadline_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -899,7 +899,7 @@ deadline_attr_store(struct kobject *kobj, struct attribute *attr,
struct deadline_fs_entry *entry = to_deadline(attr); struct deadline_fs_entry *entry = to_deadline(attr);
if (!entry->store) if (!entry->store)
return -EINVAL; return -EIO;
return entry->store(e->elevator_data, page, length); return entry->store(e->elevator_data, page, length);
} }
......
...@@ -322,7 +322,7 @@ static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr, ...@@ -322,7 +322,7 @@ static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr,
struct gendisk *disk = to_disk(kobj); struct gendisk *disk = to_disk(kobj);
struct disk_attribute *disk_attr = struct disk_attribute *disk_attr =
container_of(attr,struct disk_attribute,attr); container_of(attr,struct disk_attribute,attr);
ssize_t ret = 0; ssize_t ret = -EIO;
if (disk_attr->show) if (disk_attr->show)
ret = disk_attr->show(disk,page); ret = disk_attr->show(disk,page);
......
...@@ -3574,7 +3574,7 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page) ...@@ -3574,7 +3574,7 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
q = container_of(kobj, struct request_queue, kobj); q = container_of(kobj, struct request_queue, kobj);
if (!entry->show) if (!entry->show)
return 0; return -EIO;
return entry->show(q, page); return entry->show(q, page);
} }
...@@ -3588,7 +3588,7 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -3588,7 +3588,7 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
q = container_of(kobj, struct request_queue, kobj); q = container_of(kobj, struct request_queue, kobj);
if (!entry->store) if (!entry->store)
return -EINVAL; return -EIO;
return entry->store(q, page, length); return entry->store(q, page, length);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment