From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] perf_event_open02: migrate to newlib
Date: Thu, 21 Nov 2019 03:45:02 -0500 (EST) [thread overview]
Message-ID: <983876625.13285336.1574325902291.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20191120122910.GD14963@rei.lan>
----- Original Message -----
> Hi!
> > @@ -312,15 +238,13 @@ static void cleanup(void)
> > {
> > int i;
> >
> > - for (i = 0; i < n; i++) {
> > - if (hwfd[i] > 0 && close(hwfd[i]) == -1)
> > - tst_resm(TWARN | TERRNO, "close(%d) failed", hwfd[i]);
> > - if (tskfd[i] > 0 && close(tskfd[i]) == -1)
> > - tst_resm(TWARN | TERRNO, "close(%d) failed", tskfd[i]);
> > + for (i = 0; i < ntotal; i++) {
> > + SAFE_CLOSE(hwfd[i]);
> > + SAFE_CLOSE(tskfd[i]);
>
> Shouldn't we check that the hwfd[i] and tskfd[i] are > 0?
>
> I guess that we may do SAFE_CLOSE(0) repeatedly here in a case that
> perf_event_open() failed somewhere in the middle of the setup().
I'll add check for -1, since 0 could be valid (even though it's unlikely).
>
> Otherwise this is a nice cleanup, acked.
Thanks for review.
next prev parent reply other threads:[~2019-11-21 8:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 14:59 [LTP] [PATCH 0/3] perf_event_open02 tweaks Jan Stancek
2019-11-18 14:59 ` [LTP] [PATCH 1/3] perf_event_open02: migrate to newlib Jan Stancek
2019-11-20 12:29 ` Cyril Hrubis
2019-11-21 8:45 ` Jan Stancek [this message]
2019-11-18 14:59 ` [LTP] [PATCH 2/3] perf_event_open02: make do_work() run for specified time Jan Stancek
2019-11-20 12:33 ` Cyril Hrubis
2019-11-21 8:48 ` Jan Stancek
2019-11-21 19:21 ` [LTP] [PATCH v2 " Jan Stancek
2019-11-22 13:33 ` Cyril Hrubis
2019-11-25 14:54 ` Jan Stancek
2019-11-18 14:59 ` [LTP] [PATCH 3/3] perf_event_open02: workaround for Pentium4 Jan Stancek
2019-11-20 13:44 ` Cyril Hrubis
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=983876625.13285336.1574325902291.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/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