linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
@ 2009-12-25 19:08 Peter Huewe
  2009-12-28  8:13 ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Huewe @ 2009-12-25 19:08 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Hans-Christian Egtvedt, Haavard Skinnemoen, Andrew Morton,
	Peter Ma, linux-kernel, linux-mmc, peterhuewe

This patch fixes a build failure introduced by the patch
  atmel-mci: change use of dma slave interface by Nicolas Ferre
by changing mci_dma_slave to the correct name of mci_dma_data

This should make the avr32 tree build again.

References:
http://kisskb.ellerman.id.au/kisskb/buildresult/1893610/
http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdiff;h=2635d1ba711560d521f6218c585a3e0401f566e1

Patch against Linus' tree.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 arch/avr32/mach-at32ap/at32ap700x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 1aa1ea5..7d4ed42 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1325,7 +1325,7 @@ struct platform_device *__init
 at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 {
 	struct platform_device		*pdev;
-	struct mci_dma_slave		*slave;
+	struct mci_dma_data	        *slave;
 	u32				pioa_mask;
 	u32				piob_mask;
 
@@ -1344,7 +1344,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 				ARRAY_SIZE(atmel_mci0_resource)))
 		goto fail;
 
-	slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL);
+	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
 
 	slave->sdata.dma_dev = &dw_dmac0_device.dev;
 	slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
-- 
1.6.4.4


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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-25 19:08 [PATCH] arch/avr32: Fix build failure for avr32 caused by typo Peter Huewe
@ 2009-12-28  8:13 ` Hans-Christian Egtvedt
  2009-12-28  9:59   ` Peter Hüwe
  0 siblings, 1 reply; 8+ messages in thread
From: Hans-Christian Egtvedt @ 2009-12-28  8:13 UTC (permalink / raw)
  To: Peter Huewe
  Cc: Nicolas Ferre, Haavard Skinnemoen, Andrew Morton, Peter Ma,
	linux-kernel, linux-mmc, peterhuewe

On Fri, 25 Dec 2009 20:08:45 +0100
Peter Huewe <PeterHuewe@gmx.de> wrote:

> This patch fixes a build failure introduced by the patch
>   atmel-mci: change use of dma slave interface by Nicolas Ferre
> by changing mci_dma_slave to the correct name of mci_dma_data
> 
> This should make the avr32 tree build again.
> 

Ah, great, I have not gotten around to test this yet. Thanks for the
patch. I've done some minor changes and also fixed the kzalloc/kfree
error handling. Please see the inlined patch below.

>From c8d4b6c01b19044467867b24e218b8a59ed04291 Mon Sep 17 00:00:00 2001
From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Date: Mon, 28 Dec 2009 09:08:00 +0100
Subject: [PATCH] avr32: Fix build failure when using atmel-mci caused by typo

This patch fixes a build failure introduced by the patch atmel-mci: change use
of dma slave interface by Nicolas Ferre by changing mci_dma_slave to the
correct name of mci_dma_data.

It also will only free the struct mci_dma_data if it has been allocated.

This should make the avr32 tree build again.

References:
http://kisskb.ellerman.id.au/kisskb/buildresult/1893610/
http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdiff;h=2635d1ba711560d521f6218c585a3e0401f566e1

Patch against Linus' tree.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
---
 arch/avr32/mach-at32ap/at32ap700x.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 1aa1ea5..6e093c3 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1325,7 +1325,7 @@ struct platform_device *__init
 at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 {
 	struct platform_device		*pdev;
-	struct mci_dma_slave		*slave;
+	struct mci_dma_data		*slave;
 	u32				pioa_mask;
 	u32				piob_mask;
 
@@ -1344,7 +1344,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 				ARRAY_SIZE(atmel_mci0_resource)))
 		goto fail;
 
-	slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL);
+	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
 
 	slave->sdata.dma_dev = &dw_dmac0_device.dev;
 	slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
@@ -1357,7 +1357,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 
 	if (platform_device_add_data(pdev, data,
 				sizeof(struct mci_platform_data)))
-		goto fail;
+		goto fail_free;
 
 	/* CLK line is common to both slots */
 	pioa_mask = 1 << 10;
@@ -1381,7 +1381,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 		/* Slot is unused */
 		break;
 	default:
-		goto fail;
+		goto fail_free;
 	}
 
 	select_peripheral(PIOA, pioa_mask, PERIPH_A, 0);
@@ -1408,7 +1408,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 		break;
 	default:
 		if (!data->slot[0].bus_width)
-			goto fail;
+			goto fail_free;
 
 		data->slot[1].bus_width = 0;
 		break;
@@ -1419,9 +1419,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 	platform_device_add(pdev);
 	return pdev;
 
+fail_free:
+	kfree(slave);
 fail:
 	data->dma_slave = NULL;
-	kfree(slave);
 	platform_device_put(pdev);
 	return NULL;
 }
-- 
1.6.0.4

-- 
Best regards,
Hans-Christian Egtvedt

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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-28  8:13 ` Hans-Christian Egtvedt
@ 2009-12-28  9:59   ` Peter Hüwe
  2009-12-28 10:02     ` Hans-Christian Egtvedt
  2009-12-28 10:20     ` Haavard Skinnemoen
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Hüwe @ 2009-12-28  9:59 UTC (permalink / raw)
  To: Hans-Christian Egtvedt
  Cc: Nicolas Ferre, Haavard Skinnemoen, Andrew Morton, Peter Ma,
	linux-kernel, linux-mmc

Am Montag 28 Dezember 2009 09:13:18 schrieb Hans-Christian Egtvedt:
> On Fri, 25 Dec 2009 20:08:45 +0100
> 
> Peter Huewe <PeterHuewe@gmx.de> wrote:
> > This patch fixes a build failure introduced by the patch
> >   atmel-mci: change use of dma slave interface by Nicolas Ferre
> > by changing mci_dma_slave to the correct name of mci_dma_data
> >
> > This should make the avr32 tree build again.
> 
> Ah, great, I have not gotten around to test this yet. Thanks for the
> patch. I've done some minor changes and also fixed the kzalloc/kfree
> error handling. Please see the inlined patch below.
> 

> @@ -1344,7 +1344,7 @@ at32_add_device_mci(unsigned int id, struct
>  mci_platform_data *data) ARRAY_SIZE(atmel_mci0_resource)))
>  		goto fail;
> 
> -	slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL);
> +	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
> 
>  	slave->sdata.dma_dev = &dw_dmac0_device.dev;
>  	slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;


Great, thanks for the update.
The only thing that still catches my eye is that the kzalloc line can fail, so 
you should perhaps add something like
if (!slave) {
	printk(KERN_ERR "No memory left for at32ap700x: at32_add_device_mc");
	goto fail;
}

(not tested :)


Apart from that:
Acked-By: Peter Huewe <peterhuewe@gmx.de>


Thanks and best regards,
Peter

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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-28  9:59   ` Peter Hüwe
@ 2009-12-28 10:02     ` Hans-Christian Egtvedt
  2009-12-28 10:20     ` Haavard Skinnemoen
  1 sibling, 0 replies; 8+ messages in thread
From: Hans-Christian Egtvedt @ 2009-12-28 10:02 UTC (permalink / raw)
  To: Peter Hüwe
  Cc: Nicolas Ferre, Haavard Skinnemoen, Andrew Morton, Peter Ma,
	linux-kernel, linux-mmc

On Mon, 28 Dec 2009 10:59:30 +0100
Peter Hüwe <PeterHuewe@gmx.de> wrote:

> Am Montag 28 Dezember 2009 09:13:18 schrieb Hans-Christian Egtvedt:
> > On Fri, 25 Dec 2009 20:08:45 +0100
> > 
> > Peter Huewe <PeterHuewe@gmx.de> wrote:
> > > This patch fixes a build failure introduced by the patch
> > >   atmel-mci: change use of dma slave interface by Nicolas Ferre
> > > by changing mci_dma_slave to the correct name of mci_dma_data
> > >
> > > This should make the avr32 tree build again.
> > 
> > Ah, great, I have not gotten around to test this yet. Thanks for the
> > patch. I've done some minor changes and also fixed the kzalloc/kfree
> > error handling. Please see the inlined patch below.
> > 
> 
> > @@ -1344,7 +1344,7 @@ at32_add_device_mci(unsigned int id, struct
> >  mci_platform_data *data) ARRAY_SIZE(atmel_mci0_resource)))
> >  		goto fail;
> > 
> > -	slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL);
> > +	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
> > 
> >  	slave->sdata.dma_dev = &dw_dmac0_device.dev;
> >  	slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
> 
> 
> Great, thanks for the update.
> The only thing that still catches my eye is that the kzalloc line can fail, so 
> you should perhaps add something like
> if (!slave) {
> 	printk(KERN_ERR "No memory left for at32ap700x: at32_add_device_mc");
> 	goto fail;
> }
> 

Sounds like the patch should be split in two, one addressing the proper
naming of the struct mci_dma_data and one fixing the allocation of
memory and proper cleanup.

-- 
Best regards,
Hans-Christian Egtvedt

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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-28  9:59   ` Peter Hüwe
  2009-12-28 10:02     ` Hans-Christian Egtvedt
@ 2009-12-28 10:20     ` Haavard Skinnemoen
  2009-12-28 10:34       ` Peter Hüwe
  1 sibling, 1 reply; 8+ messages in thread
From: Haavard Skinnemoen @ 2009-12-28 10:20 UTC (permalink / raw)
  To: Peter Hüwe
  Cc: Hans-Christian Egtvedt, Nicolas Ferre, Haavard Skinnemoen,
	Andrew Morton, Peter Ma, linux-kernel, linux-mmc

Peter Hüwe <PeterHuewe@gmx.de> wrote:
> Great, thanks for the update.
> The only thing that still catches my eye is that the kzalloc line can fail, so 
> you should perhaps add something like
> if (!slave) {
> 	printk(KERN_ERR "No memory left for at32ap700x: at32_add_device_mc");
> 	goto fail;
> }

I agree, except that this is extremely unlikely to happen, so we should
either drop the printk() or use pr_debug() in order to waste as little
memory as possible in production systems.

I think your first patch is good as it is, so I will apply it. Please
send any additional fixes as a separate patch.

Haavard

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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-28 10:20     ` Haavard Skinnemoen
@ 2009-12-28 10:34       ` Peter Hüwe
  2009-12-28 11:07         ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Hüwe @ 2009-12-28 10:34 UTC (permalink / raw)
  To: Haavard Skinnemoen
  Cc: Hans-Christian Egtvedt, Nicolas Ferre, Haavard Skinnemoen,
	Andrew Morton, Peter Ma, linux-kernel, linux-mmc

Am Montag 28 Dezember 2009 11:20:28 schrieb Haavard Skinnemoen:
> Peter Hüwe <PeterHuewe@gmx.de> wrote:
> > Great, thanks for the update.
> > The only thing that still catches my eye is that the kzalloc line can
> > fail, so you should perhaps add something like
> > if (!slave) {
> > 	printk(KERN_ERR "No memory left for at32ap700x: at32_add_device_mc");
> > 	goto fail;
> > }
> 
> I agree, except that this is extremely unlikely to happen, so we should
> either drop the printk() or use pr_debug() in order to waste as little
> memory as possible in production systems.
ok.

> 
> I think your first patch is good as it is, so I will apply it. Please
> send any additional fixes as a separate patch.

Okay thanks for applying.

@Hans: can you create the cleanup patch or should I ?

Regards,
Peter

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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-28 10:34       ` Peter Hüwe
@ 2009-12-28 11:07         ` Hans-Christian Egtvedt
  2009-12-28 11:23           ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 8+ messages in thread
From: Hans-Christian Egtvedt @ 2009-12-28 11:07 UTC (permalink / raw)
  To: Peter Hüwe
  Cc: Haavard Skinnemoen, Nicolas Ferre, Haavard Skinnemoen,
	Andrew Morton, Peter Ma, linux-kernel, linux-mmc

On Mon, 28 Dec 2009 11:34:36 +0100
Peter Hüwe <PeterHuewe@gmx.de> wrote:

> Am Montag 28 Dezember 2009 11:20:28 schrieb Haavard Skinnemoen:
> > Peter Hüwe <PeterHuewe@gmx.de> wrote:
> > > Great, thanks for the update.
> > > The only thing that still catches my eye is that the kzalloc line can
> > > fail, so you should perhaps add something like
> > > if (!slave) {
> > > 	printk(KERN_ERR "No memory left for at32ap700x: at32_add_device_mc");
> > > 	goto fail;
> > > }
> > 
> > I agree, except that this is extremely unlikely to happen, so we should
> > either drop the printk() or use pr_debug() in order to waste as little
> > memory as possible in production systems.
> ok.
>

I skipped the print message, as no other platform devices will print
similar information. If people really need this kind of information
they could provide a patch adding it for all the platform devices.

> > I think your first patch is good as it is, so I will apply it. Please
> > send any additional fixes as a separate patch.
> 
> Okay thanks for applying.
> 
> @Hans: can you create the cleanup patch or should I ?
> 

I'll do it, should arrive here shortly.

-- 
Best regards,
Hans-Christian Egtvedt

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

* Re: [PATCH] arch/avr32: Fix build failure for avr32 caused by typo
  2009-12-28 11:07         ` Hans-Christian Egtvedt
@ 2009-12-28 11:23           ` Hans-Christian Egtvedt
  0 siblings, 0 replies; 8+ messages in thread
From: Hans-Christian Egtvedt @ 2009-12-28 11:23 UTC (permalink / raw)
  To: Hans-Christian Egtvedt
  Cc: Peter Hüwe, Haavard Skinnemoen, Nicolas Ferre,
	Haavard Skinnemoen, Andrew Morton, Peter Ma, linux-kernel,
	linux-mmc

On Mon, 28 Dec 2009 12:07:23 +0100
Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> wrote:

> On Mon, 28 Dec 2009 11:34:36 +0100
> Peter Hüwe <PeterHuewe@gmx.de> wrote:

<snipp>

> > > I think your first patch is good as it is, so I will apply it. Please
> > > send any additional fixes as a separate patch.
> > 
> > Okay thanks for applying.
> > 
> > @Hans: can you create the cleanup patch or should I ?
> > 
> 
> I'll do it, should arrive here shortly.
>

"here", by here I actually meant to the kernel@avr32linux.org mailing
list[1]. So I hope Håvard will snap it from there.

Sadly I just realized that the archives has been non functional since
mid November due to server misconfiguration. Fixed now.

1: http://lists.avr32linux.org/pipermail/kernel/2009-December/005484.html

-- 
Best regards,
Hans-Christian Egtvedt

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

end of thread, other threads:[~2009-12-28 11:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-25 19:08 [PATCH] arch/avr32: Fix build failure for avr32 caused by typo Peter Huewe
2009-12-28  8:13 ` Hans-Christian Egtvedt
2009-12-28  9:59   ` Peter Hüwe
2009-12-28 10:02     ` Hans-Christian Egtvedt
2009-12-28 10:20     ` Haavard Skinnemoen
2009-12-28 10:34       ` Peter Hüwe
2009-12-28 11:07         ` Hans-Christian Egtvedt
2009-12-28 11:23           ` Hans-Christian Egtvedt

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