提交 b181565e 编写于 作者: V Viresh Kumar 提交者: Grant Likely

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: NViresh Kumar <viresh.kumar@st.com>
Tested-by: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
上级 538a18dc
...@@ -1016,7 +1016,7 @@ static int configure_dma(struct pl022 *pl022) ...@@ -1016,7 +1016,7 @@ static int configure_dma(struct pl022 *pl022)
dmaengine_slave_config(txchan, &tx_conf); dmaengine_slave_config(txchan, &tx_conf);
/* Create sglists for the transfers */ /* Create sglists for the transfers */
pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1; pages = DIV_ROUND_UP(pl022->cur_transfer->len, PAGE_SIZE);
dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages); dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages);
ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC); ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册