From: Hans Verkuil Date: Tue, 18 Nov 2014 12:51:00 +0000 (-0300) Subject: [media] vb2: don't free alloc context if it is ERR_PTR X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e5ae8fa739f8a1d5c292c5b13fa33ac64166e5a0;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] vb2: don't free alloc context if it is ERR_PTR Don't try to free a pointer containing an ERR_PTR(). Signed-off-by: Hans Verkuil Acked-by: Pawel Osciak Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index c4305bf3dbed..0bfc488c8812 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -854,7 +854,8 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx); void vb2_dma_contig_cleanup_ctx(void *alloc_ctx) { - kfree(alloc_ctx); + if (!IS_ERR_OR_NULL(alloc_ctx)) + kfree(alloc_ctx); } EXPORT_SYMBOL_GPL(vb2_dma_contig_cleanup_ctx);