Skip to content

Commit

Permalink
spi/spi-pl022: Don't allocate more sg than required.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Viresh Kumar authored and Grant Likely committed Sep 21, 2011
1 parent 538a18d commit b181565
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ static int configure_dma(struct pl022 *pl022)
dmaengine_slave_config(txchan, &tx_conf);

/* 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);

ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC);
Expand Down

0 comments on commit b181565

Please sign in to comment.