Re: [PATCH 36/49] drivers/video: Use vzalloc

From: Dave Young
Date: Fri Nov 05 2010 - 01:28:01 EST


On Fri, Nov 5, 2010 at 11:08 AM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> Âdrivers/video/arcfb.c    Â|  Â5 ++---
> Âdrivers/video/broadsheetfb.c | Â Â4 +---
> Âdrivers/video/hecubafb.c   |  Â5 ++---
> Âdrivers/video/metronomefb.c Â| Â Â4 +---
> Âdrivers/video/xen-fbfront.c Â| Â Â3 +--
> Â5 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
> index 3ec4923..86573e2 100644
> --- a/drivers/video/arcfb.c
> +++ b/drivers/video/arcfb.c
> @@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev)
>
> Â Â Â Â/* We need a flat backing store for the Arc's
> Â Â Â Â Â less-flat actual paged framebuffer */
> - Â Â Â if (!(videomemory = vmalloc(videomemorysize)))
> + Â Â Â videomemory = vmalloc(videomemorysize);

typo?

> + Â Â Â if (!videomemory)
> Â Â Â Â Â Â Â Âreturn retval;
>
> - Â Â Â memset(videomemory, 0, videomemorysize);
> -
> Â Â Â Âinfo = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev);
> Â Â Â Âif (!info)
> Â Â Â Â Â Â Â Âgoto err;
> diff --git a/drivers/video/broadsheetfb.c b/drivers/video/broadsheetfb.c
> index ebda687..377dde3 100644
> --- a/drivers/video/broadsheetfb.c
> +++ b/drivers/video/broadsheetfb.c
> @@ -1101,12 +1101,10 @@ static int __devinit broadsheetfb_probe(struct platform_device *dev)
>
> Â Â Â Âvideomemorysize = roundup((dpyw*dpyh), PAGE_SIZE);
>
> - Â Â Â videomemory = vmalloc(videomemorysize);
> + Â Â Â videomemory = vzalloc(videomemorysize);
> Â Â Â Âif (!videomemory)
> Â Â Â Â Â Â Â Âgoto err_fb_rel;
>
> - Â Â Â memset(videomemory, 0, videomemorysize);
> -
> Â Â Â Âinfo->screen_base = (char *)videomemory;
> Â Â Â Âinfo->fbops = &broadsheetfb_ops;
>
> diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c
> index c77bcc6..a941e6f 100644
> --- a/drivers/video/hecubafb.c
> +++ b/drivers/video/hecubafb.c
> @@ -231,11 +231,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev)
>
> Â Â Â Âvideomemorysize = (DPY_W*DPY_H)/8;
>
> - Â Â Â if (!(videomemory = vmalloc(videomemorysize)))
> + Â Â Â videomemory = vzalloc(videomemorysize);
> + Â Â Â if (!videomemory)
> Â Â Â Â Â Â Â Âreturn retval;
>
> - Â Â Â memset(videomemory, 0, videomemorysize);
> -
> Â Â Â Âinfo = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev);
> Â Â Â Âif (!info)
> Â Â Â Â Â Â Â Âgoto err_fballoc;
> diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c
> index 63ed3b7..c0c358c 100644
> --- a/drivers/video/metronomefb.c
> +++ b/drivers/video/metronomefb.c
> @@ -628,12 +628,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev)
> Â Â Â Â/* we need to add a spare page because our csum caching scheme walks
> Â Â Â Â * to the end of the page */
> Â Â Â Âvideomemorysize = PAGE_SIZE + (fw * fh);
> - Â Â Â videomemory = vmalloc(videomemorysize);
> + Â Â Â videomemory = vzalloc(videomemorysize);
> Â Â Â Âif (!videomemory)
> Â Â Â Â Â Â Â Âgoto err_fb_rel;
>
> - Â Â Â memset(videomemory, 0, videomemorysize);
> -
> Â Â Â Âinfo->screen_base = (char __force __iomem *)videomemory;
> Â Â Â Âinfo->fbops = &metronomefb_ops;
>
> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
> index 428d273..81fcaea 100644
> --- a/drivers/video/xen-fbfront.c
> +++ b/drivers/video/xen-fbfront.c
> @@ -395,10 +395,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
> Â Â Â Âspin_lock_init(&info->dirty_lock);
> Â Â Â Âspin_lock_init(&info->resize_lock);
>
> - Â Â Â info->fb = vmalloc(fb_size);
> + Â Â Â info->fb = vzalloc(fb_size);
> Â Â Â Âif (info->fb == NULL)
> Â Â Â Â Â Â Â Âgoto error_nomem;
> - Â Â Â memset(info->fb, 0, fb_size);
>
> Â Â Â Âinfo->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
>
> --
> 1.7.3.1.g432b3.dirty
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/
>



--
Regards
dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/