merged.

Bruce


In message: [linux-yocto-v5.2][PATCH] perf time-utils: Simplify 
perf_time__parse_for_ranges() error paths slightly
on 15/04/2020 Yue Tao wrote:

> From: Adrian Hunter <[email protected]>
> 
> commit 2a8afddc084a5f5f933382758dd2767ed8a69f77 upstream.
> 
> Simplify perf_time__parse_for_ranges() error paths slightly.
> 
> Signed-off-by: Adrian Hunter <[email protected]>
> Cc: Jin Yao <[email protected]>
> Cc: Jiri Olsa <[email protected]>
> Link: http://lkml.kernel.org/r/[email protected]
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
> Signed-off-by: Yue Tao <[email protected]>
> ---
>  tools/perf/util/time-utils.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
> index 0bee09661651..ff07ea319406 100644
> --- a/tools/perf/util/time-utils.c
> +++ b/tools/perf/util/time-utils.c
> @@ -406,7 +406,7 @@ int perf_time__parse_for_ranges_reltime(const char 
> *time_str,
>  {
>       bool has_percent = strchr(time_str, '%');
>       struct perf_time_interval *ptime_range;
> -     int size, num, ret;
> +     int size, num, ret = -EINVAL;
>  
>       ptime_range = perf_time__range_alloc(time_str, &size);
>       if (!ptime_range)
> @@ -418,7 +418,6 @@ int perf_time__parse_for_ranges_reltime(const char 
> *time_str,
>                       pr_err("HINT: no first/last sample time found in perf 
> data.\n"
>                              "Please use latest perf binary to execute 'perf 
> record'\n"
>                              "(if '--buildid-all' is enabled, please set 
> '--timestamp-boundary').\n");
> -                     ret = -EINVAL;
>                       goto error;
>               }
>       }
> @@ -430,11 +429,8 @@ int perf_time__parse_for_ranges_reltime(const char 
> *time_str,
>                               session->evlist->first_sample_time,
>                               session->evlist->last_sample_time);
>  
> -             if (num < 0) {
> -                     pr_err("Invalid time string\n");
> -                     ret = -EINVAL;
> -                     goto error;
> -             }
> +             if (num < 0)
> +                     goto error_invalid;
>       } else {
>               if (perf_time__parse_str(ptime_range, time_str))
>                       goto error_invalid;
> @@ -455,6 +451,8 @@ int perf_time__parse_for_ranges_reltime(const char 
> *time_str,
>       *ranges = ptime_range;
>       return 0;
>  
> +error_invalid:
> +     pr_err("Invalid time string\n");
>  error:
>       free(ptime_range);
>       return ret;
> -- 
> 2.17.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#8602): 
https://lists.yoctoproject.org/g/linux-yocto/message/8602
Mute This Topic: https://lists.yoctoproject.org/mt/73032739/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to