Commit abe19b7b authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

dcdbas: use memory_read_from_buffer()

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Doug Warzecha <Douglas_Warzecha@dell.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f37e6617
......@@ -152,20 +152,11 @@ static ssize_t smi_data_read(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{
size_t max_read;
ssize_t ret;
mutex_lock(&smi_data_lock);
if (pos >= smi_data_buf_size) {
ret = 0;
goto out;
}
max_read = smi_data_buf_size - pos;
ret = min(max_read, count);
memcpy(buf, smi_data_buf + pos, ret);
out:
ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf,
smi_data_buf_size);
mutex_unlock(&smi_data_lock);
return ret;
}
......
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