drm/i915/overlay: Fix unpinning along init error paths
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 28 Jun 2011 10:27:47 +0000 (11:27 +0100)
committerKeith Packard <keithp@keithp.com>
Thu, 30 Jun 2011 02:09:13 +0000 (19:09 -0700)
commit79d2427338e8da362678de32a1c8af1dc8a9810a
tree5f1018e11a501c24ce9a5bc978a6df49d5adc4dc
parentdc501fbc4389f6c15a8da14684b5926e0d9553da
drm/i915/overlay: Fix unpinning along init error paths

As pointed out by Dan Carpenter, it was seemingly possible to hit an error
whilst mapping the buffer for the regs (except the only likely error
returns should not happen during init) and so leak a pin count on the
bo. To handle this we would need to reacquire the struct mutex, so for
simplicity rearrange for the lock to be held for the entire function.
For extra pedagogy, test that we only call init once.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
drivers/gpu/drm/i915/intel_overlay.c