* [PATCH] dma: mmp_pdma: fix a memory alloc error
@ 2013-05-28 12:05 Xiang Wang
2013-05-28 15:43 ` Andy Shevchenko
2013-06-17 13:02 ` Vinod Koul
0 siblings, 2 replies; 6+ messages in thread
From: Xiang Wang @ 2013-05-28 12:05 UTC (permalink / raw)
To: Dan Williams, Vinod Koul, linux-kernel; +Cc: 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..76a8dcf 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(struct mmp_pdma_phy), GFP_KERNEL);
if (pdev->phy == NULL)
return -ENOMEM;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] dma: mmp_pdma: fix a memory alloc error
2013-05-28 12:05 [PATCH] dma: mmp_pdma: fix a memory alloc error Xiang Wang
@ 2013-05-28 15:43 ` Andy Shevchenko
2013-05-31 4:56 ` Xiang Wang
2013-06-17 13:02 ` Vinod Koul
1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2013-05-28 15:43 UTC (permalink / raw)
To: Xiang Wang
Cc: Dan Williams, Vinod Koul, linux-kernel@vger.kernel.org, cxie4,
Xiang Wang
On Tue, May 28, 2013 at 3:05 PM, Xiang Wang <wangxfdu@gmail.com> 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.
Have you tested it?
> 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..76a8dcf 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(struct mmp_pdma_phy), GFP_KERNEL);
For me it seems you did get how it works.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma: mmp_pdma: fix a memory alloc error
2013-05-28 15:43 ` Andy Shevchenko
@ 2013-05-31 4:56 ` Xiang Wang
2013-06-17 11:31 ` Xiang Wang
0 siblings, 1 reply; 6+ messages in thread
From: Xiang Wang @ 2013-05-31 4:56 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Dan Williams, Vinod Koul, linux-kernel@vger.kernel.org, cxie4,
Xiang Wang
2013/5/28 Andy Shevchenko <andy.shevchenko@gmail.com>:
> On Tue, May 28, 2013 at 3:05 PM, Xiang Wang <wangxfdu@gmail.com> 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.
>
> Have you tested it?
>
>> 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..76a8dcf 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(struct mmp_pdma_phy), GFP_KERNEL);
>
> For me it seems you did get how it works.
>
> --
> With Best Regards,
> Andy Shevchenko
Hi, Andy
Yes. I've tested on marvell pxa988 platform using dmatest.ko.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma: mmp_pdma: fix a memory alloc error
2013-05-31 4:56 ` Xiang Wang
@ 2013-06-17 11:31 ` Xiang Wang
0 siblings, 0 replies; 6+ messages in thread
From: Xiang Wang @ 2013-06-17 11:31 UTC (permalink / raw)
Cc: Dan Williams, Vinod Koul, linux-kernel@vger.kernel.org, cxie4,
Xiang Wang
2013/5/31 Xiang Wang <wangxfdu@gmail.com>:
> 2013/5/28 Andy Shevchenko <andy.shevchenko@gmail.com>:
>> On Tue, May 28, 2013 at 3:05 PM, Xiang Wang <wangxfdu@gmail.com> 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.
>>
>> Have you tested it?
>>
>>> 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..76a8dcf 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(struct mmp_pdma_phy), GFP_KERNEL);
>>
>> For me it seems you did get how it works.
>>
>> --
>> With Best Regards,
>> Andy Shevchenko
>
> Hi, Andy
> Yes. I've tested on marvell pxa988 platform using dmatest.ko.
Hi, All
Do you have any comments about this patch? Thanks!
--
Regards,
Xiang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma: mmp_pdma: fix a memory alloc error
2013-05-28 12:05 [PATCH] dma: mmp_pdma: fix a memory alloc error Xiang Wang
2013-05-28 15:43 ` Andy Shevchenko
@ 2013-06-17 13:02 ` Vinod Koul
2013-06-18 8:45 ` Xiang Wang
1 sibling, 1 reply; 6+ messages in thread
From: Vinod Koul @ 2013-06-17 13:02 UTC (permalink / raw)
To: Xiang Wang; +Cc: Dan Williams, linux-kernel, cxie4, Xiang Wang
On Tue, May 28, 2013 at 08:05:13PM +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..76a8dcf 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(struct mmp_pdma_phy), GFP_KERNEL);
why not sizeof(*pdev-phy), that way you dont make above error
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma: mmp_pdma: fix a memory alloc error
2013-06-17 13:02 ` Vinod Koul
@ 2013-06-18 8:45 ` Xiang Wang
0 siblings, 0 replies; 6+ messages in thread
From: Xiang Wang @ 2013-06-18 8:45 UTC (permalink / raw)
To: Vinod Koul; +Cc: Dan Williams, linux-kernel@vger.kernel.org, cxie4, Xiang Wang
2013/6/17 Vinod Koul <vinod.koul@intel.com>:
> On Tue, May 28, 2013 at 08:05:13PM +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..76a8dcf 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(struct mmp_pdma_phy), GFP_KERNEL);
> why not sizeof(*pdev-phy), that way you dont make above error
>
> --
> ~Vinod
Hi,
Updated patch V2 to use sizeof(*pdev->phy). Thanks!
--
Regards,
Xiang
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-18 8:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28 12:05 [PATCH] dma: mmp_pdma: fix a memory alloc error Xiang Wang
2013-05-28 15:43 ` Andy Shevchenko
2013-05-31 4:56 ` Xiang Wang
2013-06-17 11:31 ` Xiang Wang
2013-06-17 13:02 ` Vinod Koul
2013-06-18 8:45 ` Xiang Wang
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).