[igt-dev] [PATCH i-g-t 02/21] lib/i915/gem_context: Help static analysis with execution flow

Petri Latvala petri.latvala at intel.com
Wed Jan 16 11:20:31 UTC 2019


If an igt_ioctl fails, errno is set to non-zero, and static analysis
doesn't quite get it. Add an igt_assume() to help.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: MichaƂ Winiarski <michal.winiarski at intel.com>
---
 lib/i915/gem_context.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 669bd318..781dea00 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -82,8 +82,10 @@ int __gem_context_create(int fd, uint32_t *ctx_id)
        memset(&create, 0, sizeof(create));
        if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create) == 0)
                *ctx_id = create.ctx_id;
-       else
-               err = -errno;
+       else {
+	       err = -errno;
+	       igt_assume(err != 0);
+       }
 
        errno = 0;
        return err;
-- 
2.19.1



More information about the igt-dev mailing list