lkml.org 
[lkml]   [2022]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] tracing: Do PTR_ERR() after IS_ERR()
From

在 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.


\
 
 \ /
  Last update: 2022-07-30 03:20    [W:0.027 / U:20.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site