[igt-dev] [PATCH i-g-t v2 02/21] lib/i915/gem_context: Help static analysis with execution flow
Petri Latvala
petri.latvala at intel.com
Fri Jan 18 10:42:10 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.
v2: Braces on both branches of an if (Chris)
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>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/i915/gem_context.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 669bd318..16004685 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -80,10 +80,12 @@ int __gem_context_create(int fd, uint32_t *ctx_id)
int err = 0;
memset(&create, 0, sizeof(create));
- if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create) == 0)
+ 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