drm/xe: Fix error paths of __xe_bo_create_locked
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 25 Jul 2023 15:12:39 +0000 (17:12 +0200)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:39:17 +0000 (11:39 -0500)
commit2a368a09ae1c3f7aebe6210927a1335186d3c6f7
tree73dea1d76b35788424bc5e3be69deb3fd65f9373
parentf82686ef74b96a51ba6c38f3ce119ba7f7995210
drm/xe: Fix error paths of __xe_bo_create_locked

ttm_bo_init_reserved() calls the destroy() callback if it fails.

Because of this, __xe_bo_create_locked is required to be responsible
for freeing the bo even when it's passed in as argument.

Additionally, if the placement check fails, the bo was kept alive.
Fix it too.

Reported-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_bo.c