regmap: Quit the read-loop based on position of file-offset
Some implementation's of the 'cat' command pass the absolute position of the file-offset. In the current implementation of 'regmap_data_read_file' this leads to dumping all the registers from offset 0. Avoid this by quitting the read loop if the file-offset requested is lower than actual read-offset. Change-Id: I7c6c31958e92f16387bf4cb5de7fbf4572fcce21 Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
This commit is contained in:
parent
9e9032d155
commit
3b6d6e9c81
1 changed files with 3 additions and 0 deletions
|
@ -340,6 +340,9 @@ static ssize_t regmap_data_read_file(struct file *file, char __user *user_buf,
|
|||
else if (*ppos >= map->dump_address * map->debugfs_tot_len
|
||||
+ map->dump_count * map->debugfs_tot_len)
|
||||
return 0;
|
||||
else if (*ppos < map->dump_address * map->debugfs_tot_len)
|
||||
return 0;
|
||||
|
||||
return regmap_read_debugfs(map, 0, map->max_register, user_buf,
|
||||
new_count, ppos);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue