linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] davinci: check for presence of channel controller on slot alloc
@ 2012-09-12 18:14 Cyril Chemparathy
  2012-10-26 11:39 ` Sekhar Nori
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Chemparathy @ 2012-09-12 18:14 UTC (permalink / raw)
  To: davinci-linux-open-source, linux-arm-kernel, linux-kernel
  Cc: khilman, nsekhar, Cyril Chemparathy

This patch adds a check for the presence of the channel controller when
trying to allocate a slot.  Without this fix, the kernel panics with a NULL
pointer dereference when the dma-engine drivers are probed.

Signed-off-by: Cyril Chemparathy <cyril@ti.com>
---
 arch/arm/mach-davinci/dma.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index a685e97..2fee31e 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel);
  */
 int edma_alloc_slot(unsigned ctlr, int slot)
 {
+	if (!edma_cc[ctlr])
+		return -ENODEV;
+
 	if (slot >= 0)
 		slot = EDMA_CHAN_SLOT(slot);
 
-- 
1.7.9.5


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

* Re: [PATCH] davinci: check for presence of channel controller on slot alloc
  2012-09-12 18:14 [PATCH] davinci: check for presence of channel controller on slot alloc Cyril Chemparathy
@ 2012-10-26 11:39 ` Sekhar Nori
  2012-10-26 11:45   ` Matt Porter
  0 siblings, 1 reply; 3+ messages in thread
From: Sekhar Nori @ 2012-10-26 11:39 UTC (permalink / raw)
  To: Cyril Chemparathy
  Cc: davinci-linux-open-source, linux-arm-kernel, linux-kernel,
	khilman, Porter, Matt

+ Matt, who is doing the DMA engine conversion for EDMA

On 9/12/2012 11:44 PM, Cyril Chemparathy wrote:
> This patch adds a check for the presence of the channel controller when
> trying to allocate a slot.  Without this fix, the kernel panics with a NULL
> pointer dereference when the dma-engine drivers are probed.
> 
> Signed-off-by: Cyril Chemparathy <cyril@ti.com>
> ---
>  arch/arm/mach-davinci/dma.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> index a685e97..2fee31e 100644
> --- a/arch/arm/mach-davinci/dma.c
> +++ b/arch/arm/mach-davinci/dma.c
> @@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel);
>   */
>  int edma_alloc_slot(unsigned ctlr, int slot)
>  {
> +	if (!edma_cc[ctlr])
> +		return -ENODEV;

I am ok with this patch, although I wonder if a better error is -ENXIO
or even -EINVAL (since its most likely the result of a wrong argument).

This patch will conflict with the EDMA movement series that Matt is
doing and he should probably include it in his series to avoid
conflicts. From the description it appears to be not required for v3.7
anyway.

Thanks,
Sekhar

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

* Re: [PATCH] davinci: check for presence of channel controller on slot alloc
  2012-10-26 11:39 ` Sekhar Nori
@ 2012-10-26 11:45   ` Matt Porter
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Porter @ 2012-10-26 11:45 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Cyril Chemparathy, khilman, davinci-linux-open-source,
	linux-kernel, linux-arm-kernel

On Fri, Oct 26, 2012 at 05:09:17PM +0530, Sekhar Nori wrote:
> + Matt, who is doing the DMA engine conversion for EDMA
> 
> On 9/12/2012 11:44 PM, Cyril Chemparathy wrote:
> > This patch adds a check for the presence of the channel controller when
> > trying to allocate a slot.  Without this fix, the kernel panics with a NULL
> > pointer dereference when the dma-engine drivers are probed.
> > 
> > Signed-off-by: Cyril Chemparathy <cyril@ti.com>
> > ---
> >  arch/arm/mach-davinci/dma.c |    3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> > index a685e97..2fee31e 100644
> > --- a/arch/arm/mach-davinci/dma.c
> > +++ b/arch/arm/mach-davinci/dma.c
> > @@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel);
> >   */
> >  int edma_alloc_slot(unsigned ctlr, int slot)
> >  {
> > +	if (!edma_cc[ctlr])
> > +		return -ENODEV;
> 
> I am ok with this patch, although I wonder if a better error is -ENXIO
> or even -EINVAL (since its most likely the result of a wrong argument).
> 
> This patch will conflict with the EDMA movement series that Matt is
> doing and he should probably include it in his series to avoid
> conflicts. From the description it appears to be not required for v3.7
> anyway.

I'll add this to the am33xx dmaengine series with -EINVAL, thanks.

-Matt

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

end of thread, other threads:[~2012-10-26 11:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12 18:14 [PATCH] davinci: check for presence of channel controller on slot alloc Cyril Chemparathy
2012-10-26 11:39 ` Sekhar Nori
2012-10-26 11:45   ` Matt Porter

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).