mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-12 00:00:00 +00:00
dell_rbu: use memory_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Abhay Salunke <Abhay_Salunke@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>
This commit is contained in:
parent
d991696263
commit
25377479de
@ -507,11 +507,6 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
|
|||||||
|
|
||||||
static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
|
static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
|
||||||
{
|
{
|
||||||
unsigned char *ptemp = NULL;
|
|
||||||
size_t bytes_left = 0;
|
|
||||||
size_t data_length = 0;
|
|
||||||
ssize_t ret_count = 0;
|
|
||||||
|
|
||||||
/* check to see if we have something to return */
|
/* check to see if we have something to return */
|
||||||
if ((rbu_data.image_update_buffer == NULL) ||
|
if ((rbu_data.image_update_buffer == NULL) ||
|
||||||
(rbu_data.bios_image_size == 0)) {
|
(rbu_data.bios_image_size == 0)) {
|
||||||
@ -519,28 +514,11 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
|
|||||||
"bios_image_size %lu\n",
|
"bios_image_size %lu\n",
|
||||||
rbu_data.image_update_buffer,
|
rbu_data.image_update_buffer,
|
||||||
rbu_data.bios_image_size);
|
rbu_data.bios_image_size);
|
||||||
ret_count = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto read_rbu_data_exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos > rbu_data.bios_image_size) {
|
return memory_read_from_buffer(buffer, count, &pos,
|
||||||
ret_count = 0;
|
rbu_data.image_update_buffer, rbu_data.bios_image_size);
|
||||||
goto read_rbu_data_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes_left = rbu_data.bios_image_size - pos;
|
|
||||||
data_length = min(bytes_left, count);
|
|
||||||
|
|
||||||
ptemp = rbu_data.image_update_buffer;
|
|
||||||
memcpy(buffer, (ptemp + pos), data_length);
|
|
||||||
|
|
||||||
if ((pos + count) > rbu_data.bios_image_size)
|
|
||||||
/* this was the last copy */
|
|
||||||
ret_count = bytes_left;
|
|
||||||
else
|
|
||||||
ret_count = count;
|
|
||||||
read_rbu_data_exit:
|
|
||||||
return ret_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t read_rbu_data(struct kobject *kobj,
|
static ssize_t read_rbu_data(struct kobject *kobj,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user