[PATCH v5 2/3] lib/igt_kms: Correct the check for igt_require
Nautiyal, Ankit K
ankit.k.nautiyal at intel.com
Thu Jan 18 06:15:21 UTC 2024
On 1/17/2024 8:23 PM, Mohammed Thasleem wrote:
> The function 'igt_debugfs_dir()' returns -1, if it fails and a non-negative
> fd otherwise. However in the function igt_get_max_dotclock() the condition
> to check the debugfs directory uses igt_require (dir), which fails even if
> the dir is 0.
> So correct the igt_require check for a valid igt_debugfs fd.
>
> v2: Correct the logic in igt_require.
>
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
> ---
> lib/igt_kms.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e4dea1a60..1b4d0d761 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6100,7 +6100,7 @@ int igt_get_max_dotclock(int fd)
> drmModeFreeResources(resources);
>
> dir = igt_debugfs_dir(fd);
> - igt_require(dir);
> + igt_require(dir != -1);
Open() does return -1 in case of failure, with errorno set, so looks
good to me.
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
>
> /*
> * Display specific clock frequency info is moved to i915_cdclk_info,
More information about the igt-dev
mailing list