Re: [PATCH] [media] videobuf2-dma-contig: return NULL if alloc fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/6/23 Jun Nie <niej0001@xxxxxxxxx>:
> return NULL if alloc fails to avoid taking error code as
> buffer pointer
>
> Signed-off-by: Jun Nie <njun@xxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux