Commit 393a949f authored by Tomi Valkeinen's avatar Tomi Valkeinen

drm/omap: fix omap_gem_put_paddr() error handling

If tiler_unpin() call in omap_gem_put_paddr() fails,
omap_gem_put_paddr() will immediately stop processing and return an
error.

This patch remoes that error checking, and also removes
omap_gem_put_paddr()'s return value, because:

 * The caller of omap_gem_put_paddr() can do nothing if an error
   happens, so it's pointless to return an error value

 * If tiler_unpin() fails, the GEM object will possibly be left in an
   undefined state, where the DMM mapping may have been removed, but the
   GEM object still thinks everything is as it should be, leading to
   crashes later.

 * There's no point in returning an error from a "free" call, as the
   caller can do nothing about it. So it's better to clean up as much as
   possible.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 9c368506
...@@ -211,7 +211,7 @@ void omap_gem_dma_sync(struct drm_gem_object *obj, ...@@ -211,7 +211,7 @@ void omap_gem_dma_sync(struct drm_gem_object *obj,
enum dma_data_direction dir); enum dma_data_direction dir);
int omap_gem_get_paddr(struct drm_gem_object *obj, int omap_gem_get_paddr(struct drm_gem_object *obj,
dma_addr_t *paddr, bool remap); dma_addr_t *paddr, bool remap);
int omap_gem_put_paddr(struct drm_gem_object *obj); void omap_gem_put_paddr(struct drm_gem_object *obj);
int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages, int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages,
bool remap); bool remap);
int omap_gem_put_pages(struct drm_gem_object *obj); int omap_gem_put_pages(struct drm_gem_object *obj);
......
...@@ -808,10 +808,10 @@ int omap_gem_get_paddr(struct drm_gem_object *obj, ...@@ -808,10 +808,10 @@ int omap_gem_get_paddr(struct drm_gem_object *obj,
/* Release physical address, when DMA is no longer being performed.. this /* Release physical address, when DMA is no longer being performed.. this
* could potentially unpin and unmap buffers from TILER * could potentially unpin and unmap buffers from TILER
*/ */
int omap_gem_put_paddr(struct drm_gem_object *obj) void omap_gem_put_paddr(struct drm_gem_object *obj)
{ {
struct omap_gem_object *omap_obj = to_omap_bo(obj); struct omap_gem_object *omap_obj = to_omap_bo(obj);
int ret = 0; int ret;
mutex_lock(&obj->dev->struct_mutex); mutex_lock(&obj->dev->struct_mutex);
if (omap_obj->paddr_cnt > 0) { if (omap_obj->paddr_cnt > 0) {
...@@ -821,7 +821,6 @@ int omap_gem_put_paddr(struct drm_gem_object *obj) ...@@ -821,7 +821,6 @@ int omap_gem_put_paddr(struct drm_gem_object *obj)
if (ret) { if (ret) {
dev_err(obj->dev->dev, dev_err(obj->dev->dev,
"could not unpin pages: %d\n", ret); "could not unpin pages: %d\n", ret);
goto fail;
} }
ret = tiler_release(omap_obj->block); ret = tiler_release(omap_obj->block);
if (ret) { if (ret) {
...@@ -832,9 +831,8 @@ int omap_gem_put_paddr(struct drm_gem_object *obj) ...@@ -832,9 +831,8 @@ int omap_gem_put_paddr(struct drm_gem_object *obj)
omap_obj->block = NULL; omap_obj->block = NULL;
} }
} }
fail:
mutex_unlock(&obj->dev->struct_mutex); mutex_unlock(&obj->dev->struct_mutex);
return ret;
} }
/* Get rotated scanout address (only valid if already pinned), at the /* Get rotated scanout address (only valid if already pinned), at the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment