From: "Ser, Simon" <simon.ser@intel.com>
To: "Latvala, Petri" <petri.latvala@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_eld: fix eld_is_supported failing if not supported
Date: Fri, 13 Sep 2019 10:58:13 +0000 [thread overview]
Message-ID: <0eacd61ec9d36f7c53ac798e7fa58c6aec1fd0cb.camel@intel.com> (raw)
In-Reply-To: <20190913104219.GR4019@platvala-desk.ger.corp.intel.com>
On Fri, 2019-09-13 at 13:42 +0300, Petri Latvala wrote:
> On Fri, Sep 13, 2019 at 01:23:40PM +0300, Simon Ser wrote:
> > When glob(3) doesn't find any results, it returns GLOB_NOMATCH.
> > I've been
> > confused by GLOB_NOCHECK's description and thought it would return
> > 0.
> >
> > Instead of failing on the assert, return that ELDs aren't supported
> > in case
> > there's no match.
> >
> > While at it, also include glob's return value in the assert
> > message.
> >
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > Fixes: 3374cd0b048f ("lib/igt_eld: introduce eld_is_supported")
> > Cc: Petri Latvala <petri.latvala@intel.com>
> > ---
> >
> > Sorry about the fuss.
> >
> > lib/igt_eld.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/igt_eld.c b/lib/igt_eld.c
> > index 5d1d8e01cd33..23ebf6305ae0 100644
> > --- a/lib/igt_eld.c
> > +++ b/lib/igt_eld.c
> > @@ -270,11 +270,14 @@ bool eld_has_igt(void)
> > bool eld_is_supported(void)
> > {
> > glob_t glob_buf = {0};
> > + int ret;
> > bool has_elds;
> >
> > - igt_assert_f(glob("/proc/asound/card*/" ELD_PREFIX "*",
> > - GLOB_NOSORT, NULL, &glob_buf) == 0,
> > - "glob failed\n");
> > + ret = glob("/proc/asound/card*/" ELD_PREFIX "*",
> > + GLOB_NOSORT, NULL, &glob_buf);
> > + if (ret == GLOB_NOMATCH)
> > + return false;
> > + igt_assert_f(ret == 0, "glob failed: %d\n", ret);
>
> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Thanks for the review. Please merge yourself when CI says it's fine, I
won't be there to do it.
>
> > has_elds = glob_buf.gl_pathc > 0;
> > globfree(&glob_buf);
> >
> > --
> > 2.23.0
> >
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-09-13 10:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 10:23 [igt-dev] [PATCH i-g-t] lib/igt_eld: fix eld_is_supported failing if not supported Simon Ser
2019-09-13 10:42 ` Petri Latvala
2019-09-13 10:58 ` Ser, Simon [this message]
2019-09-13 12:07 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-09-14 8:36 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=0eacd61ec9d36f7c53ac798e7fa58c6aec1fd0cb.camel@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.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