diff mbox series

perf tools: Simplify the calculation of variables

Message ID 1612497255-87189-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Not Applicable
Headers show
Series perf tools: Simplify the calculation of variables | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Jiapeng Chong Feb. 5, 2021, 3:54 a.m. UTC
Fix the following coccicheck warnings:

./tools/perf/util/header.c:3809:18-20: WARNING !A || A && B is
equivalent to !A || B.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Olsa Feb. 5, 2021, 9:49 a.m. UTC | #1
On Fri, Feb 05, 2021 at 11:54:15AM +0800, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./tools/perf/util/header.c:3809:18-20: WARNING !A || A && B is
> equivalent to !A || B.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  tools/perf/util/header.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index c4ed3dc..4fe9e2a 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -3806,7 +3806,7 @@ int perf_session__read_header(struct perf_session *session)
>  	 * check for the pipe header regardless of source.
>  	 */
>  	err = perf_header__read_pipe(session);
> -	if (!err || (err && perf_data__is_pipe(data))) {
> +	if (!err || perf_data__is_pipe(data)) {

mama mia, thanks

Acked-by: Jiri Olsa <jolsa@redhat.com>

jirka

>  		data->is_pipe = true;
>  		return err;
>  	}
> -- 
> 1.8.3.1
>
Arnaldo Carvalho de Melo Feb. 18, 2021, 1:14 p.m. UTC | #2
Em Fri, Feb 05, 2021 at 10:49:15AM +0100, Jiri Olsa escreveu:
> On Fri, Feb 05, 2021 at 11:54:15AM +0800, Jiapeng Chong wrote:
> > Fix the following coccicheck warnings:
> > 
> > ./tools/perf/util/header.c:3809:18-20: WARNING !A || A && B is
> > equivalent to !A || B.
> > 
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> > ---
> >  tools/perf/util/header.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> > index c4ed3dc..4fe9e2a 100644
> > --- a/tools/perf/util/header.c
> > +++ b/tools/perf/util/header.c
> > @@ -3806,7 +3806,7 @@ int perf_session__read_header(struct perf_session *session)
> >  	 * check for the pipe header regardless of source.
> >  	 */
> >  	err = perf_header__read_pipe(session);
> > -	if (!err || (err && perf_data__is_pipe(data))) {
> > +	if (!err || perf_data__is_pipe(data)) {
> 
> mama mia, thanks
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks, applied.

- Arnaldo

 
> jirka
> 
> >  		data->is_pipe = true;
> >  		return err;
> >  	}
> > -- 
> > 1.8.3.1
> > 
>
diff mbox series

Patch

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index c4ed3dc..4fe9e2a 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -3806,7 +3806,7 @@  int perf_session__read_header(struct perf_session *session)
 	 * check for the pipe header regardless of source.
 	 */
 	err = perf_header__read_pipe(session);
-	if (!err || (err && perf_data__is_pipe(data))) {
+	if (!err || perf_data__is_pipe(data)) {
 		data->is_pipe = true;
 		return err;
 	}