From: Petri Latvala <petri.latvala@intel.com>
To: Simon Ser <simon.ser@intel.com>
Cc: 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 13:42:19 +0300 [thread overview]
Message-ID: <20190913104219.GR4019@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20190913102340.4784-1-simon.ser@intel.com>
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>
> 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:42 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 [this message]
2019-09-13 10:58 ` Ser, Simon
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=20190913104219.GR4019@platvala-desk.ger.corp.intel.com \
--to=petri.latvala@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=simon.ser@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