mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
perf dso: Simplify dso_cache__read function
There's no need for the while loop now, also we can connect two (ret > 0) condition legs together. Signed-off-by: Jiri Olsa <[email protected]> Acked-by: Song Liu <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Cc: Stanislav Fomichev <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
ea5db1bd5a
commit
cacddfe7b0
1 changed files with 6 additions and 11 deletions
|
|
@ -823,25 +823,20 @@ static ssize_t
|
|||
dso_cache__read(struct dso *dso, struct machine *machine,
|
||||
u64 offset, u8 *data, ssize_t size)
|
||||
{
|
||||
u64 cache_offset = offset & DSO__DATA_CACHE_MASK;
|
||||
struct dso_cache *cache;
|
||||
struct dso_cache *old;
|
||||
ssize_t ret;
|
||||
|
||||
do {
|
||||
u64 cache_offset = offset & DSO__DATA_CACHE_MASK;
|
||||
|
||||
cache = zalloc(sizeof(*cache) + DSO__DATA_CACHE_SIZE);
|
||||
if (!cache)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = file_read(dso, machine, cache_offset, cache->data);
|
||||
cache = zalloc(sizeof(*cache) + DSO__DATA_CACHE_SIZE);
|
||||
if (!cache)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = file_read(dso, machine, cache_offset, cache->data);
|
||||
if (ret > 0) {
|
||||
cache->offset = cache_offset;
|
||||
cache->size = ret;
|
||||
} while (0);
|
||||
|
||||
|
||||
if (ret > 0) {
|
||||
old = dso_cache__insert(dso, cache);
|
||||
if (old) {
|
||||
/* we lose the race */
|
||||
|
|
|
|||
Loading…
Reference in a new issue