Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulka...@wdc.com>.

On 05/12/2019 08:55 AM, Akinobu Mita wrote:
> Use memory_read_from_buffer() to simplify devcd_readv().
>
> Cc: Johannes Berg <johan...@sipsolutions.net>
> Cc: Keith Busch <keith.bu...@intel.com>
> Cc: Jens Axboe <ax...@fb.com>
> Cc: Christoph Hellwig <h...@lst.de>
> Cc: Sagi Grimberg <s...@grimberg.me>
> Cc: Minwoo Im <minwoo.im....@gmail.com>
> Cc: Kenneth Heitke <kenneth.hei...@intel.com>
> Reviewed-by: Johannes Berg <johan...@sipsolutions.net>
> Signed-off-by: Akinobu Mita <akinobu.m...@gmail.com>
> ---
> * v3
> - No change since v2
>
>   drivers/base/devcoredump.c | 11 +----------
>   1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
> index f1a3353..3c960a6 100644
> --- a/drivers/base/devcoredump.c
> +++ b/drivers/base/devcoredump.c
> @@ -164,16 +164,7 @@ static struct class devcd_class = {
>   static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count,
>                          void *data, size_t datalen)
>   {
> -     if (offset > datalen)
> -             return -EINVAL;
> -
> -     if (offset + count > datalen)
> -             count = datalen - offset;
> -
> -     if (count)
> -             memcpy(buffer, ((u8 *)data) + offset, count);
> -
> -     return count;
> +     return memory_read_from_buffer(buffer, count, &offset, data, datalen);
>   }
>
>   static void devcd_freev(void *data)
>

Reply via email to