diff options
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 1aa1ea5e9212..e67c99945428 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
16 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
17 | #include <linux/usb/atmel_usba_udc.h> | 18 | #include <linux/usb/atmel_usba_udc.h> |
@@ -1325,7 +1326,7 @@ struct platform_device *__init | |||
1325 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | 1326 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) |
1326 | { | 1327 | { |
1327 | struct platform_device *pdev; | 1328 | struct platform_device *pdev; |
1328 | struct mci_dma_slave *slave; | 1329 | struct mci_dma_data *slave; |
1329 | u32 pioa_mask; | 1330 | u32 pioa_mask; |
1330 | u32 piob_mask; | 1331 | u32 piob_mask; |
1331 | 1332 | ||
@@ -1344,7 +1345,9 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1344 | ARRAY_SIZE(atmel_mci0_resource))) | 1345 | ARRAY_SIZE(atmel_mci0_resource))) |
1345 | goto fail; | 1346 | goto fail; |
1346 | 1347 | ||
1347 | slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL); | 1348 | slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL); |
1349 | if (!slave) | ||
1350 | goto fail; | ||
1348 | 1351 | ||
1349 | slave->sdata.dma_dev = &dw_dmac0_device.dev; | 1352 | slave->sdata.dma_dev = &dw_dmac0_device.dev; |
1350 | slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT; | 1353 | slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT; |
@@ -1357,7 +1360,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1357 | 1360 | ||
1358 | if (platform_device_add_data(pdev, data, | 1361 | if (platform_device_add_data(pdev, data, |
1359 | sizeof(struct mci_platform_data))) | 1362 | sizeof(struct mci_platform_data))) |
1360 | goto fail; | 1363 | goto fail_free; |
1361 | 1364 | ||
1362 | /* CLK line is common to both slots */ | 1365 | /* CLK line is common to both slots */ |
1363 | pioa_mask = 1 << 10; | 1366 | pioa_mask = 1 << 10; |
@@ -1381,7 +1384,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1381 | /* Slot is unused */ | 1384 | /* Slot is unused */ |
1382 | break; | 1385 | break; |
1383 | default: | 1386 | default: |
1384 | goto fail; | 1387 | goto fail_free; |
1385 | } | 1388 | } |
1386 | 1389 | ||
1387 | select_peripheral(PIOA, pioa_mask, PERIPH_A, 0); | 1390 | select_peripheral(PIOA, pioa_mask, PERIPH_A, 0); |
@@ -1408,7 +1411,7 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1408 | break; | 1411 | break; |
1409 | default: | 1412 | default: |
1410 | if (!data->slot[0].bus_width) | 1413 | if (!data->slot[0].bus_width) |
1411 | goto fail; | 1414 | goto fail_free; |
1412 | 1415 | ||
1413 | data->slot[1].bus_width = 0; | 1416 | data->slot[1].bus_width = 0; |
1414 | break; | 1417 | break; |
@@ -1419,9 +1422,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1419 | platform_device_add(pdev); | 1422 | platform_device_add(pdev); |
1420 | return pdev; | 1423 | return pdev; |
1421 | 1424 | ||
1425 | fail_free: | ||
1426 | kfree(slave); | ||
1422 | fail: | 1427 | fail: |
1423 | data->dma_slave = NULL; | 1428 | data->dma_slave = NULL; |
1424 | kfree(slave); | ||
1425 | platform_device_put(pdev); | 1429 | platform_device_put(pdev); |
1426 | return NULL; | 1430 | return NULL; |
1427 | } | 1431 | } |
@@ -1767,10 +1771,13 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data) | |||
1767 | ARRAY_SIZE(usba0_resource))) | 1771 | ARRAY_SIZE(usba0_resource))) |
1768 | goto out_free_pdev; | 1772 | goto out_free_pdev; |
1769 | 1773 | ||
1770 | if (data) | 1774 | if (data) { |
1771 | usba_data.pdata.vbus_pin = data->vbus_pin; | 1775 | usba_data.pdata.vbus_pin = data->vbus_pin; |
1772 | else | 1776 | usba_data.pdata.vbus_pin_inverted = data->vbus_pin_inverted; |
1777 | } else { | ||
1773 | usba_data.pdata.vbus_pin = -EINVAL; | 1778 | usba_data.pdata.vbus_pin = -EINVAL; |
1779 | usba_data.pdata.vbus_pin_inverted = -EINVAL; | ||
1780 | } | ||
1774 | 1781 | ||
1775 | data = &usba_data.pdata; | 1782 | data = &usba_data.pdata; |
1776 | data->num_ep = ARRAY_SIZE(at32_usba_ep); | 1783 | data->num_ep = ARRAY_SIZE(at32_usba_ep); |