Message ID | BANLkTimHtpaScRYe2kuFNW9Ja9x343aOTQ@mail.gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
2011/6/23 Jun Nie <niej0001@gmail.com>: > return NULL if alloc fails to avoid taking error code as > buffer pointer > > Signed-off-by: Jun Nie <njun@marvell.com> > --- > drivers/media/video/videobuf2-dma-contig.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/video/videobuf2-dma-contig.c > b/drivers/media/video/videobuf2-dma-contig.c > index a790a5f..8e8c7aa 100644 > --- a/drivers/media/video/videobuf2-dma-contig.c > +++ b/drivers/media/video/videobuf2-dma-contig.c > @@ -40,7 +40,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, > unsigned long size) > > buf = kzalloc(sizeof *buf, GFP_KERNEL); > if (!buf) > - return ERR_PTR(-ENOMEM); > + return NULL; > > buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr, > GFP_KERNEL); > @@ -48,7 +48,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, > unsigned long size) > dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", > size); > kfree(buf); > - return ERR_PTR(-ENOMEM); > + return NULL; > } > > buf->conf = conf; > -- > 1.7.0.4 > How do you think about this fix? Thanks! Jun -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 12 Jul 2011, Jun Nie wrote: > 2011/6/23 Jun Nie <niej0001@gmail.com>: > > return NULL if alloc fails to avoid taking error code as > > buffer pointer > > > > Signed-off-by: Jun Nie <njun@marvell.com> It shouldn't be needed with this: https://patchwork.kernel.org/patch/654861/ Thanks Guennadi > > --- > > drivers/media/video/videobuf2-dma-contig.c | 4 ++-- > > 1 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/video/videobuf2-dma-contig.c > > b/drivers/media/video/videobuf2-dma-contig.c > > index a790a5f..8e8c7aa 100644 > > --- a/drivers/media/video/videobuf2-dma-contig.c > > +++ b/drivers/media/video/videobuf2-dma-contig.c > > @@ -40,7 +40,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, > > unsigned long size) > > > > buf = kzalloc(sizeof *buf, GFP_KERNEL); > > if (!buf) > > - return ERR_PTR(-ENOMEM); > > + return NULL; > > > > buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr, > > GFP_KERNEL); > > @@ -48,7 +48,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, > > unsigned long size) > > dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", > > size); > > kfree(buf); > > - return ERR_PTR(-ENOMEM); > > + return NULL; > > } > > > > buf->conf = conf; > > -- > > 1.7.0.4 > > > > How do you think about this fix? > Thanks! > > Jun > --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index a790a5f..8e8c7aa 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -40,7 +40,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) - return ERR_PTR(-ENOMEM); + return NULL; buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr,
return NULL if alloc fails to avoid taking error code as buffer pointer Signed-off-by: Jun Nie <njun@marvell.com> --- drivers/media/video/videobuf2-dma-contig.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) GFP_KERNEL); @@ -48,7 +48,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", size); kfree(buf); - return ERR_PTR(-ENOMEM); + return NULL; } buf->conf = conf;