intel: Review use of errno.
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 2 Dec 2009 12:40:26 +0000 (12:40 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 2 Dec 2009 14:17:04 +0000 (14:17 +0000)
commitacb4aa671507aa181b3ff50ccf26a1c0d705a309
treeac34b4422a04d3acfe0831b7c229ee044db44d4f
parent9fec2a8cb28d814da4fdd97b25e9cc5c10768c87
intel: Review use of errno.

Hitting this error lead to a segfault:

  intel_bufmgr_gem.c:919: Error mapping buffer 48607 (pixmap):
                          Cannot allocate memory.

because the errno was reused as the function return value after being
reset by the fprintf(), so caller thought the mapping had succeeded. The
convention established by libdrm is that the return value is the
negative errno and that uses of libdrm cannot trust the value of errno
afterwards, but must use the return code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
intel/intel_bufmgr_gem.c