mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3/4] drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code
@ 2010-10-02 13:59 Julia Lawall
  2010-10-02 14:07 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-10-02 13:59 UTC (permalink / raw)
  To: David Airlie; +Cc: kernel-janitors, dri-devel, linux-kernel

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>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
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(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index bced9b2..cfe5978 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -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 ||


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/4] drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code
  2010-10-02 13:59 [PATCH 3/4] drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code Julia Lawall
@ 2010-10-02 14:07 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2010-10-02 14:07 UTC (permalink / raw)
  To: Julia Lawall, David Airlie; +Cc: kernel-janitors, dri-devel, linux-kernel

On Sat,  2 Oct 2010 15:59:17 +0200, Julia Lawall <julia@diku.dk> wrote:
> Extend the error handling code with operations found in other nearby error
> handling code

Thanks, your fix was correct. Applied.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-02 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-02 13:59 [PATCH 3/4] drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code Julia Lawall
2010-10-02 14:07 ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®