Skip to content

Commit abe19b7

Browse files
mitatorvalds
authored andcommitted
dcdbas: use memory_read_from_buffer()
Signed-off-by: Akinobu 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f37e661 commit abe19b7

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎drivers/firmware/dcdbas.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,11 @@ static ssize_t smi_data_read(struct kobject *kobj,
152152
struct bin_attribute *bin_attr,
153153
char *buf, loff_t pos, size_t count)
154154
{
155-
size_t max_read;
156155
ssize_t ret;
157156

158157
mutex_lock(&smi_data_lock);
159-
160-
if (pos >= smi_data_buf_size) {
161-
ret = 0;
162-
goto out;
163-
}
164-
165-
max_read = smi_data_buf_size - pos;
166-
ret = min(max_read, count);
167-
memcpy(buf, smi_data_buf + pos, ret);
168-
out:
158+
ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf,
159+
smi_data_buf_size);
169160
mutex_unlock(&smi_data_lock);
170161
return ret;
171162
}

0 commit comments

Comments
 (0)