Skip to content

Commit

Permalink
devcoredump: use memory_read_from_buffer
Browse files Browse the repository at this point in the history
Use memory_read_from_buffer() to simplify devcd_readv().

Reviewed-by: Chaitanya Kulkarni <[email protected]>
Reviewed-by: Johannes Berg <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mita authored and gregkh committed Aug 15, 2019
1 parent 9c1c5e0 commit ce684d9
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions drivers/base/devcoredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ce684d9

Please sign in to comment.