Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -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;
}