diff options
author | Mayank Rana <mrana@codeaurora.org> | 2011-12-07 22:36:08 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-09 22:10:04 -0500 |
commit | 8431de80dad20979cc8354a90f70e2faac017932 (patch) | |
tree | e5b8357dd31a65405f3d9b4887a7b22724a1e988 /drivers/tty/serial/msm_serial_hs.c | |
parent | 7f97c000e87751fdca69d14cba2bbba795c1a972 (diff) |
msm_serial_hs: Fix type inconsistency for tx and rx command_ptr_ptr
Both tx and rx command_ptr_ptr are of type u32*. While allocating
memory for it, sizeof(u32 *) is used as part of kmalloc API instead
of sizeof(u32). ADM Hardare requires size of command_ptr_ptr as 1 Word.
Both sizeof(u32 *) and sizeof(u32) are same on 32-bit architecture
whereas sizeof(u32 *) would be different in size compare to sizeof(u32)
on anyother architecture.
Hence correct usage of sizeof(command_ptr_ptr) for Tx and Rx with
kmalloc and dma_(map/unmap)_single APIs.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/serial/msm_serial_hs.c')
-rw-r--r-- | drivers/tty/serial/msm_serial_hs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index 60c6eb850265..9f67b62cb77d 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c | |||
@@ -422,9 +422,9 @@ static int __devexit msm_hs_remove(struct platform_device *pdev) | |||
422 | msm_uport->rx.rbuffer); | 422 | msm_uport->rx.rbuffer); |
423 | dma_pool_destroy(msm_uport->rx.pool); | 423 | dma_pool_destroy(msm_uport->rx.pool); |
424 | 424 | ||
425 | dma_unmap_single(dev, msm_uport->rx.cmdptr_dmaaddr, sizeof(u32 *), | 425 | dma_unmap_single(dev, msm_uport->rx.cmdptr_dmaaddr, sizeof(u32), |
426 | DMA_TO_DEVICE); | 426 | DMA_TO_DEVICE); |
427 | dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr_ptr, sizeof(u32 *), | 427 | dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr_ptr, sizeof(u32), |
428 | DMA_TO_DEVICE); | 428 | DMA_TO_DEVICE); |
429 | dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr, sizeof(dmov_box), | 429 | dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr, sizeof(dmov_box), |
430 | DMA_TO_DEVICE); | 430 | DMA_TO_DEVICE); |
@@ -812,7 +812,7 @@ static void msm_hs_submit_tx_locked(struct uart_port *uport) | |||
812 | *tx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(tx->mapped_cmd_ptr); | 812 | *tx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(tx->mapped_cmd_ptr); |
813 | 813 | ||
814 | dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr_ptr, | 814 | dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr_ptr, |
815 | sizeof(u32 *), DMA_TO_DEVICE); | 815 | sizeof(u32), DMA_TO_DEVICE); |
816 | 816 | ||
817 | /* Save tx_count to use in Callback */ | 817 | /* Save tx_count to use in Callback */ |
818 | tx->tx_count = tx_count; | 818 | tx->tx_count = tx_count; |
@@ -1537,7 +1537,7 @@ static int __devinit uartdm_init_port(struct uart_port *uport) | |||
1537 | if (!tx->command_ptr) | 1537 | if (!tx->command_ptr) |
1538 | return -ENOMEM; | 1538 | return -ENOMEM; |
1539 | 1539 | ||
1540 | tx->command_ptr_ptr = kmalloc(sizeof(u32 *), GFP_KERNEL | __GFP_DMA); | 1540 | tx->command_ptr_ptr = kmalloc(sizeof(u32), GFP_KERNEL | __GFP_DMA); |
1541 | if (!tx->command_ptr_ptr) { | 1541 | if (!tx->command_ptr_ptr) { |
1542 | ret = -ENOMEM; | 1542 | ret = -ENOMEM; |
1543 | goto err_tx_command_ptr_ptr; | 1543 | goto err_tx_command_ptr_ptr; |
@@ -1547,7 +1547,7 @@ static int __devinit uartdm_init_port(struct uart_port *uport) | |||
1547 | sizeof(dmov_box), DMA_TO_DEVICE); | 1547 | sizeof(dmov_box), DMA_TO_DEVICE); |
1548 | tx->mapped_cmd_ptr_ptr = dma_map_single(uport->dev, | 1548 | tx->mapped_cmd_ptr_ptr = dma_map_single(uport->dev, |
1549 | tx->command_ptr_ptr, | 1549 | tx->command_ptr_ptr, |
1550 | sizeof(u32 *), DMA_TO_DEVICE); | 1550 | sizeof(u32), DMA_TO_DEVICE); |
1551 | tx->xfer.cmdptr = DMOV_CMD_ADDR(tx->mapped_cmd_ptr_ptr); | 1551 | tx->xfer.cmdptr = DMOV_CMD_ADDR(tx->mapped_cmd_ptr_ptr); |
1552 | 1552 | ||
1553 | init_waitqueue_head(&rx->wait); | 1553 | init_waitqueue_head(&rx->wait); |
@@ -1575,7 +1575,7 @@ static int __devinit uartdm_init_port(struct uart_port *uport) | |||
1575 | goto err_rx_command_ptr; | 1575 | goto err_rx_command_ptr; |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | rx->command_ptr_ptr = kmalloc(sizeof(u32 *), GFP_KERNEL | __GFP_DMA); | 1578 | rx->command_ptr_ptr = kmalloc(sizeof(u32), GFP_KERNEL | __GFP_DMA); |
1579 | if (!rx->command_ptr_ptr) { | 1579 | if (!rx->command_ptr_ptr) { |
1580 | pr_err("%s(): cannot allocate rx->command_ptr_ptr", __func__); | 1580 | pr_err("%s(): cannot allocate rx->command_ptr_ptr", __func__); |
1581 | ret = -ENOMEM; | 1581 | ret = -ENOMEM; |
@@ -1593,7 +1593,7 @@ static int __devinit uartdm_init_port(struct uart_port *uport) | |||
1593 | *rx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(rx->mapped_cmd_ptr); | 1593 | *rx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(rx->mapped_cmd_ptr); |
1594 | 1594 | ||
1595 | rx->cmdptr_dmaaddr = dma_map_single(uport->dev, rx->command_ptr_ptr, | 1595 | rx->cmdptr_dmaaddr = dma_map_single(uport->dev, rx->command_ptr_ptr, |
1596 | sizeof(u32 *), DMA_TO_DEVICE); | 1596 | sizeof(u32), DMA_TO_DEVICE); |
1597 | rx->xfer.cmdptr = DMOV_CMD_ADDR(rx->cmdptr_dmaaddr); | 1597 | rx->xfer.cmdptr = DMOV_CMD_ADDR(rx->cmdptr_dmaaddr); |
1598 | 1598 | ||
1599 | INIT_WORK(&rx->tty_work, msm_hs_tty_flip_buffer_work); | 1599 | INIT_WORK(&rx->tty_work, msm_hs_tty_flip_buffer_work); |
@@ -1609,7 +1609,7 @@ err_dma_pool_alloc: | |||
1609 | dma_pool_destroy(msm_uport->rx.pool); | 1609 | dma_pool_destroy(msm_uport->rx.pool); |
1610 | err_dma_pool_create: | 1610 | err_dma_pool_create: |
1611 | dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr_ptr, | 1611 | dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr_ptr, |
1612 | sizeof(u32 *), DMA_TO_DEVICE); | 1612 | sizeof(u32), DMA_TO_DEVICE); |
1613 | dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr, | 1613 | dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr, |
1614 | sizeof(dmov_box), DMA_TO_DEVICE); | 1614 | sizeof(dmov_box), DMA_TO_DEVICE); |
1615 | kfree(msm_uport->tx.command_ptr_ptr); | 1615 | kfree(msm_uport->tx.command_ptr_ptr); |