diff options
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-dma-contig.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 78c281c55ad7..b35f38e9f2d7 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -148,6 +148,7 @@ static void vb2_dc_put(void *buf_priv) kfree(buf->sgt_base); } dma_free_coherent(buf->dev, buf->size, buf->vaddr, buf->dma_addr); + put_device(buf->dev); kfree(buf); } @@ -168,7 +169,8 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) return ERR_PTR(-ENOMEM); } - buf->dev = dev; + /* Prevent the device from being released while the buffer is used */ + buf->dev = get_device(dev); buf->size = size; buf->handler.refcount = &buf->refcount; |