Skip to content

Commit

Permalink
drivers/video/fsl-diu-fb.c: use devm_ functions
Browse files Browse the repository at this point in the history
The various devm_ functions allocate memory that is released when a driver
detaches.  This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.

Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
  • Loading branch information
Damien Cassou authored and Florian Tobias Schandinat committed Aug 23, 2012
1 parent ae1937f commit c1f383d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/video/fsl-diu-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1501,8 +1501,8 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
unsigned int i;
int ret;

data = dma_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
&dma_addr, GFP_DMA | __GFP_ZERO);
data = dmam_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
&dma_addr, GFP_DMA | __GFP_ZERO);
if (!data)
return -ENOMEM;
data->dma_addr = dma_addr;
Expand Down Expand Up @@ -1628,9 +1628,6 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)

iounmap(data->diu_reg);

dma_free_coherent(&pdev->dev, sizeof(struct fsl_diu_data), data,
data->dma_addr);

return ret;
}

Expand All @@ -1648,9 +1645,6 @@ static int fsl_diu_remove(struct platform_device *pdev)

iounmap(data->diu_reg);

dma_free_coherent(&pdev->dev, sizeof(struct fsl_diu_data), data,
data->dma_addr);

return 0;
}

Expand Down

0 comments on commit c1f383d

Please sign in to comment.