From: Jani Nikula <jani.nikula@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] lib/sysfs: Repair override of params = -1
Date: Thu, 10 Jan 2019 18:01:07 +0200 [thread overview]
Message-ID: <87va2w5wos.fsf@intel.com> (raw)
In-Reply-To: <20190110153622.23897-1-chris@chris-wilson.co.uk>
On Thu, 10 Jan 2019, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Commit e27626898b87 ("igt: Check the physical swizzle status") stopped
> trying to chase the parameters from the device sysfs, entirely by
> accident. Make it a tiny bit more robust by forgiving the sysfs device
> not being present and jumping to the /sys/module + driver name param
> lookup fallback.
>
> Reported-by: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@intel.com>
Thanks,
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> lib/igt_sysfs.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
> index d323b81dd..cce342a05 100644
> --- a/lib/igt_sysfs.c
> +++ b/lib/igt_sysfs.c
> @@ -189,7 +189,7 @@ bool igt_sysfs_set_parameter(int device,
>
> /**
> * igt_sysfs_open_parameters:
> - * @device: fd of the device (or -1 to default to Intel)
> + * @device: fd of the device
> *
> * This opens the module parameters directory (under sysfs) corresponding
> * to the device for use with igt_sysfs_set() and igt_sysfs_get().
> @@ -199,15 +199,15 @@ bool igt_sysfs_set_parameter(int device,
> */
> int igt_sysfs_open_parameters(int device)
> {
> - int dir, params;
> + int dir, params = -1;
>
> dir = igt_sysfs_open(device, ¶ms);
> - if (dir < 0)
> - return -1;
> -
> - params = -1;
> - //params = openat(dir, "device/driver/module/parameters", O_RDONLY);
> - close(dir);
> + if (dir >= 0) {
> + params = openat(dir,
> + "device/driver/module/parameters",
> + O_RDONLY);
> + close(dir);
> + }
>
> if (params < 0) { /* builtin? */
> drm_version_t version;
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-01-10 15:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 15:36 [igt-dev] [PATCH i-g-t] lib/sysfs: Repair override of params = -1 Chris Wilson
2019-01-10 16:01 ` Jani Nikula [this message]
2019-01-10 16:10 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-10 23:27 ` [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=87va2w5wos.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.