]> git.baikalelectronics.ru Git - kernel.git/commit
drm/omap: fix dma_addr refcounting
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 14 Nov 2019 08:03:43 +0000 (10:03 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 4 Dec 2019 17:11:28 +0000 (19:11 +0200)
commitb677f823d29acaeaf55e76d1fedcfe80f0cb19db
tree16c52ad673b2b2c92e08ada351c5d2ea79794e76
parentfe9d07e08dde97618abc4bfdc28cce44900678c6
drm/omap: fix dma_addr refcounting

c0d8d8199f5bf5b312f05e337f486a6f651f91ae ("drm/omap: use refcount API to
track the number of users of dma_addr") changed omap_gem.c to use
refcounting API to track dma_addr uses.  However, the driver only tracks
the refcounts for non-contiguous buffers, and the patch didn't fully
take this in account.

After the patch, the driver always decreased refcount in omap_gem_unpin,
instead of decreasing the refcount only for non-contiguous buffers. This
leads to refcounting mismatch.

As for the contiguous cases the refcount is never increased, fix this
issue by returning from omap_gem_unpin if the buffer being unpinned is
contiguous.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191114080343.30704-1-tomi.valkeinen@ti.com
Fixes: c0d8d8199f5b ("drm/omap: use refcount API to track the number of users of dma_addr")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/gpu/drm/omapdrm/omap_gem.c