diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-10 10:17:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-10 10:17:54 -0500 |
commit | 5993fe31c0e9646233ff4ecea32e3c899036eda9 (patch) | |
tree | f089d05ab2729e0eea89dc0e93cab9d5186b47f4 /arch | |
parent | 53910146dfc118d9f86eeb88775ccd6fafebb09d (diff) | |
parent | cbf8de1620cdb1abb5b0618ff561004f816064fc (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6:
avr32: clean up memory allocation in at32_add_device_mci
arch/avr32: Fix build failure for avr32 caused by typo
Diffstat (limited to 'arch')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 1aa1ea5e9212..b13d1879e51b 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1325,7 +1325,7 @@ struct platform_device *__init | |||
1325 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | 1325 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) |
1326 | { | 1326 | { |
1327 | struct platform_device *pdev; | 1327 | struct platform_device *pdev; |
1328 | struct mci_dma_slave *slave; | 1328 | struct mci_dma_data *slave; |
1329 | u32 pioa_mask; | 1329 | u32 pioa_mask; |
1330 | u32 piob_mask; | 1330 | u32 piob_mask; |
1331 | 1331 | ||
@@ -1344,7 +1344,9 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1344 | ARRAY_SIZE(atmel_mci0_resource))) | 1344 | ARRAY_SIZE(atmel_mci0_resource))) |
1345 | goto fail; | 1345 | goto fail; |
1346 | 1346 | ||
1347 | slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL); | 1347 | slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL); |
1348 | if (!slave) | ||
1349 | goto fail; | ||
1348 | 1350 | ||
1349 | slave->sdata.dma_dev = &dw_dmac0_device.dev; | 1351 | slave->sdata.dma_dev = &dw_dmac0_device.dev; |
1350 | slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT; | 1352 | slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT; |
@@ -1357,7 +1359,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1357 | 1359 | ||
1358 | if (platform_device_add_data(pdev, data, | 1360 | if (platform_device_add_data(pdev, data, |
1359 | sizeof(struct mci_platform_data))) | 1361 | sizeof(struct mci_platform_data))) |
1360 | goto fail; | 1362 | goto fail_free; |
1361 | 1363 | ||
1362 | /* CLK line is common to both slots */ | 1364 | /* CLK line is common to both slots */ |
1363 | pioa_mask = 1 << 10; | 1365 | pioa_mask = 1 << 10; |
@@ -1381,7 +1383,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1381 | /* Slot is unused */ | 1383 | /* Slot is unused */ |
1382 | break; | 1384 | break; |
1383 | default: | 1385 | default: |
1384 | goto fail; | 1386 | goto fail_free; |
1385 | } | 1387 | } |
1386 | 1388 | ||
1387 | select_peripheral(PIOA, pioa_mask, PERIPH_A, 0); | 1389 | select_peripheral(PIOA, pioa_mask, PERIPH_A, 0); |
@@ -1408,7 +1410,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1408 | break; | 1410 | break; |
1409 | default: | 1411 | default: |
1410 | if (!data->slot[0].bus_width) | 1412 | if (!data->slot[0].bus_width) |
1411 | goto fail; | 1413 | goto fail_free; |
1412 | 1414 | ||
1413 | data->slot[1].bus_width = 0; | 1415 | data->slot[1].bus_width = 0; |
1414 | break; | 1416 | break; |
@@ -1419,9 +1421,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1419 | platform_device_add(pdev); | 1421 | platform_device_add(pdev); |
1420 | return pdev; | 1422 | return pdev; |
1421 | 1423 | ||
1424 | fail_free: | ||
1425 | kfree(slave); | ||
1422 | fail: | 1426 | fail: |
1423 | data->dma_slave = NULL; | 1427 | data->dma_slave = NULL; |
1424 | kfree(slave); | ||
1425 | platform_device_put(pdev); | 1428 | platform_device_put(pdev); |
1426 | return NULL; | 1429 | return NULL; |
1427 | } | 1430 | } |