X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=drivers%2Fmedia%2Fv4l2-core%2Fvideobuf2-dma-contig.c;h=fb6a177be46191012c7b88a09b5ab8446efed18b;hb=9fce0c226536fc36c7fb0a80000ca38a995be43e;hp=59fa204b15f32d9a184e9881172b731f4b070480;hpb=d4c06c708123c652025d04fe77b7e39448077395;p=cascardo%2Flinux.git diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 59fa204b15f3..fb6a177be461 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -141,6 +141,9 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs, { struct vb2_dc_buf *buf; + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -493,6 +496,9 @@ static void *vb2_dc_get_userptr(struct device *dev, unsigned long vaddr, return ERR_PTR(-EINVAL); } + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -673,6 +679,9 @@ static void *vb2_dc_attach_dmabuf(struct device *dev, struct dma_buf *dbuf, if (dbuf->size < size) return ERR_PTR(-EFAULT); + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM);