lkml.org 
[lkml]   [2011]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] pch_dma: Modify redundant memory allocation
From
Date
On Tue, 2011-10-11 at 21:43 +0900, Tomoya MORINAGA wrote:
> nr_channels is defined in "struct pch_dma".
> and struct pch_dma_chan is defined in "struct pch_dma".
> So, "sizeof(struct pch_dma_chan) * nr_channels" is unnecessary.
>
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>
> ---
> drivers/dma/pch_dma.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
> index e72bfeb..d78f526 100644
> --- a/drivers/dma/pch_dma.c
> +++ b/drivers/dma/pch_dma.c
> @@ -811,8 +811,7 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev,
> int i;
>
> nr_channels = id->driver_data;
> - pd = kzalloc(sizeof(struct pch_dma)+
> - sizeof(struct pch_dma_chan) * nr_channels, GFP_KERNEL);
> + pd = kzalloc(sizeof(struct pch_dma), GFP_KERNEL);
kernel convention is
sizeof(*pd)

> if (!pd)
> return -ENOMEM;
>


--
~Vinod



\
 
 \ /
  Last update: 2011-10-11 16:07    [W:0.026 / U:4.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site