aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2011-08-10 07:42:11 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-09-21 11:41:47 -0400
commitb181565ee6a0f894bd6a134b9e5bed2966bdf9b3 (patch)
tree729ac09ecdf3fd9b16f98b5dc92b46f6f8a1b45d /drivers/spi
parent538a18dc189ef5d0b87c987d8460515b5e2e8588 (diff)
spi/spi-pl022: Don't allocate more sg than required.
In routine configure_dma(), if transfer->len = PAGE_SIZE, then pages is one more than required. While leads to one more sg getting allocated. This is wrong. Correct this to allocate correct number of sg. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-pl022.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 01e9aa45ea88..248674c8a8c2 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -1016,7 +1016,7 @@ static int configure_dma(struct pl022 *pl022)
1016 dmaengine_slave_config(txchan, &tx_conf); 1016 dmaengine_slave_config(txchan, &tx_conf);
1017 1017
1018 /* Create sglists for the transfers */ 1018 /* Create sglists for the transfers */
1019 pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1; 1019 pages = DIV_ROUND_UP(pl022->cur_transfer->len, PAGE_SIZE);
1020 dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages); 1020 dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages);
1021 1021
1022 ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC); 1022 ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC);