Commit d9cef21a authored by Akinobu Mita's avatar Akinobu Mita Committed by Heiko Carstens

[S390] s390/cio: use memory_read_from_buffer()

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 7785857a
...@@ -143,21 +143,14 @@ static ssize_t chp_measurement_chars_read(struct kobject *kobj, ...@@ -143,21 +143,14 @@ static ssize_t chp_measurement_chars_read(struct kobject *kobj,
{ {
struct channel_path *chp; struct channel_path *chp;
struct device *device; struct device *device;
unsigned int size;
device = container_of(kobj, struct device, kobj); device = container_of(kobj, struct device, kobj);
chp = to_channelpath(device); chp = to_channelpath(device);
if (!chp->cmg_chars) if (!chp->cmg_chars)
return 0; return 0;
size = sizeof(struct cmg_chars); return memory_read_from_buffer(buf, count, &off,
chp->cmg_chars, sizeof(struct cmg_chars));
if (off > size)
return 0;
if (off + count > size)
count = size - off;
memcpy(buf, chp->cmg_chars + off, count);
return count;
} }
static struct bin_attribute chp_measurement_chars_attr = { static struct bin_attribute chp_measurement_chars_attr = {
......
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