linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] dma: mmp_pdma: fix a memory alloc error
@ 2013-06-18  6:21 Xiang Wang
  2013-07-03 12:12 ` Xiang Wang
  2013-07-05  6:45 ` Vinod Koul
  0 siblings, 2 replies; 7+ messages in thread
From: Xiang Wang @ 2013-06-18  6:21 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel; +Cc: wangxfdu, cxie4, Xiang Wang

From: Xiang Wang <wangx@marvell.com>

pdev->phy is of type "struct mmp_pdma_phy *". But when
allocating memory for it, "struct mmp_pdma_chan" is used
by mistake.

Signed-off-by: Xiang Wang <wangx@marvell.com>
---
 drivers/dma/mmp_pdma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index c26699f..18ac57f 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -801,7 +801,7 @@ static int mmp_pdma_probe(struct platform_device *op)
 	}
 
 	pdev->phy = devm_kzalloc(pdev->dev,
-		dma_channels * sizeof(struct mmp_pdma_chan), GFP_KERNEL);
+		dma_channels * sizeof(*pdev->phy), GFP_KERNEL);
 	if (pdev->phy == NULL)
 		return -ENOMEM;
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dma: mmp_pdma: fix a memory alloc error
  2013-06-18  6:21 [PATCH v2] dma: mmp_pdma: fix a memory alloc error Xiang Wang
@ 2013-07-03 12:12 ` Xiang Wang
  2013-07-05  6:45 ` Vinod Koul
  1 sibling, 0 replies; 7+ messages in thread
From: Xiang Wang @ 2013-07-03 12:12 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel; +Cc: Xiang Wang, cxie4, Xiang Wang

Hi,
Do you have any comments about this patch? Have modified according to
Vinod's advice. Thanks!

2013/6/18 Xiang Wang <wangxfdu@gmail.com>:
> From: Xiang Wang <wangx@marvell.com>
>
> pdev->phy is of type "struct mmp_pdma_phy *". But when
> allocating memory for it, "struct mmp_pdma_chan" is used
> by mistake.
>
> Signed-off-by: Xiang Wang <wangx@marvell.com>
> ---
>  drivers/dma/mmp_pdma.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
> index c26699f..18ac57f 100644
> --- a/drivers/dma/mmp_pdma.c
> +++ b/drivers/dma/mmp_pdma.c
> @@ -801,7 +801,7 @@ static int mmp_pdma_probe(struct platform_device *op)
>         }
>
>         pdev->phy = devm_kzalloc(pdev->dev,
> -               dma_channels * sizeof(struct mmp_pdma_chan), GFP_KERNEL);
> +               dma_channels * sizeof(*pdev->phy), GFP_KERNEL);
>         if (pdev->phy == NULL)
>                 return -ENOMEM;
>
> --
> 1.7.5.4
>



-- 
Regards,
Xiang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dma: mmp_pdma: fix a memory alloc error
  2013-06-18  6:21 [PATCH v2] dma: mmp_pdma: fix a memory alloc error Xiang Wang
  2013-07-03 12:12 ` Xiang Wang
@ 2013-07-05  6:45 ` Vinod Koul
  2013-07-25  2:22   ` Xiang Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2013-07-05  6:45 UTC (permalink / raw)
  To: Xiang Wang; +Cc: Dan Williams, linux-kernel, cxie4, Xiang Wang

On Tue, Jun 18, 2013 at 02:21:58PM +0800, Xiang Wang wrote:
> From: Xiang Wang <wangx@marvell.com>
> 
> pdev->phy is of type "struct mmp_pdma_phy *". But when
> allocating memory for it, "struct mmp_pdma_chan" is used
> by mistake.
> 
> Signed-off-by: Xiang Wang <wangx@marvell.com>
> ---
>  drivers/dma/mmp_pdma.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
> index c26699f..18ac57f 100644
> --- a/drivers/dma/mmp_pdma.c
> +++ b/drivers/dma/mmp_pdma.c
> @@ -801,7 +801,7 @@ static int mmp_pdma_probe(struct platform_device *op)
>  	}
>  
>  	pdev->phy = devm_kzalloc(pdev->dev,
> -		dma_channels * sizeof(struct mmp_pdma_chan), GFP_KERNEL);
> +		dma_channels * sizeof(*pdev->phy), GFP_KERNEL);
While at it, can you make the flag GFP_NOWAIT. that is the recommendation for
dmac drivers

--
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dma: mmp_pdma: fix a memory alloc error
  2013-07-05  6:45 ` Vinod Koul
@ 2013-07-25  2:22   ` Xiang Wang
  2013-07-29  5:29     ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Xiang Wang @ 2013-07-25  2:22 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Dan Williams, linux-kernel, cxie4, Xiang Wang

2013/7/5 Vinod Koul <vinod.koul@intel.com>:
> On Tue, Jun 18, 2013 at 02:21:58PM +0800, Xiang Wang wrote:
>> From: Xiang Wang <wangx@marvell.com>
>>
>> pdev->phy is of type "struct mmp_pdma_phy *". But when
>> allocating memory for it, "struct mmp_pdma_chan" is used
>> by mistake.
>>
>> Signed-off-by: Xiang Wang <wangx@marvell.com>
>> ---
>>  drivers/dma/mmp_pdma.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
>> index c26699f..18ac57f 100644
>> --- a/drivers/dma/mmp_pdma.c
>> +++ b/drivers/dma/mmp_pdma.c
>> @@ -801,7 +801,7 @@ static int mmp_pdma_probe(struct platform_device *op)
>>       }
>>
>>       pdev->phy = devm_kzalloc(pdev->dev,
>> -             dma_channels * sizeof(struct mmp_pdma_chan), GFP_KERNEL);
>> +             dma_channels * sizeof(*pdev->phy), GFP_KERNEL);
> While at it, can you make the flag GFP_NOWAIT. that is the recommendation for
> dmac drivers
>
> --
> ~Vinod

Hi, Vinod
Would you please explain a little more about why we should use
GFP_NOWAIT here? This memory is not dedicated for DMA controller. Do
we have special reasons to use GFP_NOWAIT? Thanks!

-- 
Regards,
Xiang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dma: mmp_pdma: fix a memory alloc error
  2013-07-25  2:22   ` Xiang Wang
@ 2013-07-29  5:29     ` Vinod Koul
  2013-08-01  2:27       ` Xiang Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2013-07-29  5:29 UTC (permalink / raw)
  To: Xiang Wang; +Cc: Dan Williams, linux-kernel, cxie4, Xiang Wang

On Thu, Jul 25, 2013 at 10:22:50AM +0800, Xiang Wang wrote:

Btw its generally a good idea to remove the parts not required for further
discussion

> Would you please explain a little more about why we should use
> GFP_NOWAIT here? This memory is not dedicated for DMA controller. Do
> we have special reasons to use GFP_NOWAIT? Thanks!
There are few reasons
- the dma requests can be triggered from atomic context
- so for above you can argue to use the GFP_ATOMIC and the guideline for dma
  drivers [1] was discussed briefly

~Vinod
[1]: http://lkml.indiana.edu/hypermail/linux/kernel/0911.1/02316.html

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dma: mmp_pdma: fix a memory alloc error
  2013-07-29  5:29     ` Vinod Koul
@ 2013-08-01  2:27       ` Xiang Wang
  2013-08-19  9:17         ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Xiang Wang @ 2013-08-01  2:27 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Dan Williams, linux-kernel, cxie4, Xiang Wang

2013/7/29 Vinod Koul <vinod.koul@intel.com>:
> On Thu, Jul 25, 2013 at 10:22:50AM +0800, Xiang Wang wrote:
>
> Btw its generally a good idea to remove the parts not required for further
> discussion
>
>> Would you please explain a little more about why we should use
>> GFP_NOWAIT here? This memory is not dedicated for DMA controller. Do
>> we have special reasons to use GFP_NOWAIT? Thanks!
> There are few reasons
> - the dma requests can be triggered from atomic context
> - so for above you can argue to use the GFP_ATOMIC and the guideline for dma
>   drivers [1] was discussed briefly
>
> ~Vinod
> [1]: http://lkml.indiana.edu/hypermail/linux/kernel/0911.1/02316.html
>
> --
Hi, Vinod
Thanks for your explanation. But want to double confirm with you that
the memory alloc in my patch is in probe function, still need to use
GFP_NOWAIT? Thanks!

-- 
Regards,
Xiang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] dma: mmp_pdma: fix a memory alloc error
  2013-08-01  2:27       ` Xiang Wang
@ 2013-08-19  9:17         ` Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2013-08-19  9:17 UTC (permalink / raw)
  To: Xiang Wang; +Cc: Dan Williams, linux-kernel, cxie4, Xiang Wang

On Thu, Aug 01, 2013 at 10:27:47AM +0800, Xiang Wang wrote:
> 2013/7/29 Vinod Koul <vinod.koul@intel.com>:
> > On Thu, Jul 25, 2013 at 10:22:50AM +0800, Xiang Wang wrote:
> >
> > Btw its generally a good idea to remove the parts not required for further
> > discussion
> >
> >> Would you please explain a little more about why we should use
> >> GFP_NOWAIT here? This memory is not dedicated for DMA controller. Do
> >> we have special reasons to use GFP_NOWAIT? Thanks!
> > There are few reasons
> > - the dma requests can be triggered from atomic context
> > - so for above you can argue to use the GFP_ATOMIC and the guideline for dma
> >   drivers [1] was discussed briefly
> >
> > ~Vinod
> > [1]: http://lkml.indiana.edu/hypermail/linux/kernel/0911.1/02316.html
> >
> > --
> Hi, Vinod
> Thanks for your explanation. But want to double confirm with you that
> the memory alloc in my patch is in probe function, still need to use
> GFP_NOWAIT? Thanks!
Yes I would recommend it

~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-19 10:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18  6:21 [PATCH v2] dma: mmp_pdma: fix a memory alloc error Xiang Wang
2013-07-03 12:12 ` Xiang Wang
2013-07-05  6:45 ` Vinod Koul
2013-07-25  2:22   ` Xiang Wang
2013-07-29  5:29     ` Vinod Koul
2013-08-01  2:27       ` Xiang Wang
2013-08-19  9:17         ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).