All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Taeung Song <treeze.taeung@gmail.com>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config()
Date: Mon, 19 Jun 2017 15:32:35 -0300	[thread overview]
Message-ID: <20170619183235.GQ3645@kernel.org> (raw)
In-Reply-To: <1497671197-20450-1-git-send-email-treeze.taeung@gmail.com>

Em Sat, Jun 17, 2017 at 12:46:37PM +0900, Taeung Song escreveu:
> show_spec_config() and set_config() can be called multiple times
> in the loop in cmd_config().
> However, The error cases of them wasn't checked, so fix it.

Thanks, applied.
 
> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
>  tools/perf/builtin-config.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
> index 7545966..bb1be79 100644
> --- a/tools/perf/builtin-config.c
> +++ b/tools/perf/builtin-config.c
> @@ -225,10 +225,23 @@ int cmd_config(int argc, const char **argv)
>  				break;
>  			}
>  
> -			if (value == NULL)
> +			if (value == NULL) {
>  				ret = show_spec_config(set, var);
> -			else
> +				if (ret < 0) {
> +					pr_err("%s is not configured: %s\n",
> +					       var, config_filename);
> +					free(arg);
> +					break;
> +				}
> +			} else {
>  				ret = set_config(set, config_filename, var, value);
> +				if (ret < 0) {
> +					pr_err("Failed to set '%s=%s' on %s\n",
> +					       var, value, config_filename);
> +					free(arg);
> +					break;
> +				}
> +			}
>  			free(arg);
>  		}
>  	}
> -- 
> 2.7.4

  reply	other threads:[~2017-06-19 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-17  3:46 [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config() Taeung Song
2017-06-19 18:32 ` Arnaldo Carvalho de Melo [this message]
2017-06-20  9:07 ` [tip:perf/core] " tip-bot for Taeung Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170619183235.GQ3645@kernel.org \
    --to=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=treeze.taeung@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.