lkml.org 
[lkml]   [2008]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch -v2 16/23] firmware: use memory_read_from_buffer
    Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
    Cc: Greg Kroah-Hartman <greg@kroah.com>
    ---
    drivers/base/firmware_class.c | 13 ++++---------
    1 file changed, 4 insertions(+), 9 deletions(-)

    Index: 2.6-git/drivers/base/firmware_class.c
    ===================================================================
    --- 2.6-git.orig/drivers/base/firmware_class.c
    +++ 2.6-git/drivers/base/firmware_class.c
    @@ -17,6 +17,7 @@
    #include <linux/bitops.h>
    #include <linux/mutex.h>
    #include <linux/kthread.h>
    +#include <linux/fs.h>

    #include <linux/firmware.h>
    #include "base.h"
    @@ -176,7 +177,7 @@ firmware_data_read(struct kobject *kobj,
    struct device *dev = to_dev(kobj);
    struct firmware_priv *fw_priv = dev_get_drvdata(dev);
    struct firmware *fw;
    - ssize_t ret_count = count;
    + ssize_t ret_count;

    mutex_lock(&fw_lock);
    fw = fw_priv->fw;
    @@ -184,14 +185,8 @@ firmware_data_read(struct kobject *kobj,
    ret_count = -ENODEV;
    goto out;
    }
    - if (offset > fw->size) {
    - ret_count = 0;
    - goto out;
    - }
    - if (offset + ret_count > fw->size)
    - ret_count = fw->size - offset;
    -
    - memcpy(buffer, fw->data + offset, ret_count);
    + ret_count = memory_read_from_buffer(buffer, count, &offset,
    + fw->data, fw->size);
    out:
    mutex_unlock(&fw_lock);
    return ret_count;
    --


    \
     
     \ /
      Last update: 2008-06-02 01:35    [W:0.041 / U:1.252 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site