Re: [PATCH 2/5] drivers/video/bf54x-lq043fb.c: use devm_ functions

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

 



On 08/03/2012 03:40 PM, Damien Cassou wrote:
> From: Damien Cassou <damien.cassou@xxxxxxx>
> 
> The various devm_ functions allocate memory that is released when a driver
> detaches. This patch replaces the use of kzalloc by devm_kzalloc.
> 
> Signed-off-by: Damien Cassou <damien.cassou@xxxxxxx>

Applied.


Thanks,

Florian Tobias Schandinat

> 
> ---
>  drivers/video/bf54x-lq043fb.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
> index dc2f004..47702ee 100644
> --- a/drivers/video/bf54x-lq043fb.c
> +++ b/drivers/video/bf54x-lq043fb.c
> @@ -601,7 +601,8 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
> 
>  	fbinfo->fbops = &bfin_bf54x_fb_ops;
> 
> -	fbinfo->pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL);
> +	fbinfo->pseudo_palette = devm_kzalloc(&pdev->dev, sizeof(u32) * 16,
> +					      GFP_KERNEL);
>  	if (!fbinfo->pseudo_palette) {
>  		printk(KERN_ERR DRIVER_NAME
>  		       "Fail to allocate pseudo_palette\n");
> @@ -616,7 +617,7 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
>  		       "Fail to allocate colormap (%d entries)\n",
>  		       BFIN_LCD_NBR_PALETTE_ENTRIES);
>  		ret = -EFAULT;
> -		goto out5;
> +		goto out4;
>  	}
> 
>  	if (request_ports(info)) {
> @@ -671,8 +672,6 @@ out7:
>  	free_ports(info);
>  out6:
>  	fb_dealloc_cmap(&fbinfo->cmap);
> -out5:
> -	kfree(fbinfo->pseudo_palette);
>  out4:
>  	dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
>  			  info->dma_handle);
> @@ -699,7 +698,6 @@ static int __devexit bfin_bf54x_remove(struct platform_device *pdev)
>  		dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
>  				  info->dma_handle);
> 
> -	kfree(fbinfo->pseudo_palette);
>  	fb_dealloc_cmap(&fbinfo->cmap);
> 
>  #ifndef NO_BL_SUPPORT
> 

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux