aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/dell_rbu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware/dell_rbu.c')
-rw-r--r--drivers/firmware/dell_rbu.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index 7430e218cda6..13946ebd77d6 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -507,11 +507,6 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
507 507
508static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) 508static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
509{ 509{
510 unsigned char *ptemp = NULL;
511 size_t bytes_left = 0;
512 size_t data_length = 0;
513 ssize_t ret_count = 0;
514
515 /* check to see if we have something to return */ 510 /* check to see if we have something to return */
516 if ((rbu_data.image_update_buffer == NULL) || 511 if ((rbu_data.image_update_buffer == NULL) ||
517 (rbu_data.bios_image_size == 0)) { 512 (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)
519 "bios_image_size %lu\n", 514 "bios_image_size %lu\n",
520 rbu_data.image_update_buffer, 515 rbu_data.image_update_buffer,
521 rbu_data.bios_image_size); 516 rbu_data.bios_image_size);
522 ret_count = -ENOMEM; 517 return -ENOMEM;
523 goto read_rbu_data_exit;
524 }
525
526 if (pos > rbu_data.bios_image_size) {
527 ret_count = 0;
528 goto read_rbu_data_exit;
529 } 518 }
530 519
531 bytes_left = rbu_data.bios_image_size - pos; 520 return memory_read_from_buffer(buffer, count, &pos,
532 data_length = min(bytes_left, count); 521 rbu_data.image_update_buffer, rbu_data.bios_image_size);
533
534 ptemp = rbu_data.image_update_buffer;
535 memcpy(buffer, (ptemp + pos), data_length);
536
537 if ((pos + count) > rbu_data.bios_image_size)
538 /* this was the last copy */
539 ret_count = bytes_left;
540 else
541 ret_count = count;
542 read_rbu_data_exit:
543 return ret_count;
544} 522}
545 523
546static ssize_t read_rbu_data(struct kobject *kobj, 524static ssize_t read_rbu_data(struct kobject *kobj,