mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: liqiong <liqiong@nfschina.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, yuzhe@nfschina.com,
	renyu@nfschina.com, jiaming@nfschina.com
Subject: Re: [PATCH] tracing: Do PTR_ERR() after IS_ERR()
Date: Fri, 29 Jul 2022 12:56:47 -0400	[thread overview]
Message-ID: <20220729125647.746379e5@rorschach.local.home> (raw)
In-Reply-To: <efce3a4c-4480-99f5-0229-a44009ebe9d8@nfschina.com>

On Thu, 28 Jul 2022 08:28:08 +0800
liqiong <liqiong@nfschina.com> wrote:

> It's all right, assign  PTR_ERR()  to 'ret'  anyway.
> But this assignment is valid only at the "IS_ERR()" path.
> Maybe it is better put "PTR_ERR()" at error path, keep the code clear.

No it does not. It adds unnecessary brackets.

It is common in the kernel to have:

	ret = ERROR;
	if (some_condition())
		goto out;

	ret = ERROR1;
	if (some_other_condition())
		goto out;

	ret = ERROR2;
	if (some_new_condition())
		goto out;

	ret = 0;
out:
	return ret;

And your change breaks this.

-- Steve

  reply	other threads:[~2022-07-29 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 15:35 Li Qiong
2022-07-27 16:28 ` Steven Rostedt
2022-07-28  0:28   ` liqiong
2022-07-29 16:56     ` Steven Rostedt [this message]
2022-07-30  1:20       ` 李力琼

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=20220729125647.746379e5@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=jiaming@nfschina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liqiong@nfschina.com \
    --cc=mingo@redhat.com \
    --cc=renyu@nfschina.com \
    --cc=yuzhe@nfschina.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®