mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <mhiramat@kernel.org>,
	<ast@kernel.org>, <jbacik@fb.com>, <akpm@linux-foundation.org>
Subject: Re: [PATCH -next 2/3] fail_function: refctor code of checking return value of register_kprobe()
Date: Mon, 12 Sep 2022 18:37:30 +0900	[thread overview]
Message-ID: <20220912183730.5890cbbc5c062145c07a577a@kernel.org> (raw)
In-Reply-To: <20220826073337.2085798-2-yangyingliang@huawei.com>

On Fri, 26 Aug 2022 15:33:36 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:

> Refactor the error handling of register_kprobe() to improve readability.
> No functional change.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

OK, but in this case, could you fold [2/3] and [3/3], because
[3/3] can not be applied without this change.

Thank you,

> ---
>  kernel/fail_function.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/fail_function.c b/kernel/fail_function.c
> index 03643e33e4c3..893e8f9a9118 100644
> --- a/kernel/fail_function.c
> +++ b/kernel/fail_function.c
> @@ -294,14 +294,13 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,
>  	}
>  
>  	ret = register_kprobe(&attr->kp);
> -	if (!ret)
> -		fei_debugfs_add_attr(attr);
> -	if (ret < 0)
> +	if (ret) {
>  		fei_attr_remove(attr);
> -	else {
> -		list_add_tail(&attr->list, &fei_attr_list);
> -		ret = count;
> +		goto out;
>  	}
> +	fei_debugfs_add_attr(attr);
> +	list_add_tail(&attr->list, &fei_attr_list);
> +	ret = count;
>  out:
>  	mutex_unlock(&fei_lock);
>  	kfree(buf);
> -- 
> 2.25.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2022-09-12  9:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  7:33 [PATCH -next 1/3] fail_function: Switch to memdup_user_nul() helper Yang Yingliang
2022-08-26  7:33 ` [PATCH -next 2/3] fail_function: refctor code of checking return value of register_kprobe() Yang Yingliang
2022-09-12  9:37   ` Masami Hiramatsu [this message]
2022-08-26  7:33 ` [PATCH -next 3/3] fail_function: fix wrong use of fei_attr_remove() Yang Yingliang
2022-09-12  9:37 ` [PATCH -next 1/3] fail_function: Switch to memdup_user_nul() helper Masami Hiramatsu

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=20220912183730.5890cbbc5c062145c07a577a@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=jbacik@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangyingliang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®