From: 李力琼 <liqiong@nfschina.com>
To: Steven Rostedt <rostedt@goodmis.org>
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: Sat, 30 Jul 2022 09:20:06 +0800 [thread overview]
Message-ID: <61a8a192-d10a-18f2-94f5-69c0902bb403@nfschina.com> (raw)
In-Reply-To: <20220729125647.746379e5@rorschach.local.home>
在 2022/7/30 00:56, Steven Rostedt 写道:
> 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
I got it, Thanks.
prev parent reply other threads:[~2022-07-30 1:20 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
2022-07-30 1:20 ` 李力琼 [this message]
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=61a8a192-d10a-18f2-94f5-69c0902bb403@nfschina.com \
--to=liqiong@nfschina.com \
--cc=jiaming@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=renyu@nfschina.com \
--cc=rostedt@goodmis.org \
--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®