Skip to contentSkip to conversation

drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code

PATCH Applied Julia Lawall 2 participants 2 messages Oct 2, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code

Extend the error handling code with operations found in other nearby error handling code

A simplified version of the sematic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
@r@
statement S1,S2,S3;
constant C1,C2,C3;
@@

*if (...)
{... S1 return -C1;}
...
*if (...)
{... when != S1

    return -C2;}

...
*if (...)
{... S1 return -C3;}
// </smpl>

---
This is only a suggestion. All of the other ways out of this function call these two functions. But I don't understand the code well enough to know why, or whether there is a reason not to do it in this case.

 drivers/gpu/drm/i915/i915_gem.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +2 -0
index bced9b2..cfe5978 100644
@@ -3258,6 +3258,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
 				  (int) reloc->offset,
 				  reloc->read_domains,
 				  reloc->write_domain);
+			drm_gem_object_unreference(target_obj);
+			i915_gem_object_unpin(obj);
 			return -EINVAL;
 		}
 		if (reloc->write_domain & I915_GEM_DOMAIN_CPU ||
#1 lore raw
Quoted 2 lines · Julia Lawall

Extend the error handling code with operations found in other nearby error handling code

Thanks, your fix was correct. Applied.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre