Skip to content

Commit 0d319dd

Browse files
Yann-lmsstorulf
authored andcommitted
mmc: mmci: stm32: correctly check all elements of sg list
Use sg and not data->sg when checking sg list elements. Else only the first element alignment is checked. The last element should be checked the same way, for_each_sg already set sg to sg_next(sg). Fixes: 46b723d ("mmc: mmci: add stm32 sdmmc variant") Cc: stable@vger.kernel.org Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Link: https://lore.kernel.org/r/20220317111944.116148-2-yann.gautier@foss.st.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 7e2646e commit 0d319dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/mmc/host/mmci_stm32_sdmmc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ static int sdmmc_idma_validate_data(struct mmci_host *host,
6262
* excepted the last element which has no constraint on idmasize
6363
*/
6464
for_each_sg(data->sg, sg, data->sg_len - 1, i) {
65-
if (!IS_ALIGNED(data->sg->offset, sizeof(u32)) ||
66-
!IS_ALIGNED(data->sg->length, SDMMC_IDMA_BURST)) {
65+
if (!IS_ALIGNED(sg->offset, sizeof(u32)) ||
66+
!IS_ALIGNED(sg->length, SDMMC_IDMA_BURST)) {
6767
dev_err(mmc_dev(host->mmc),
6868
"unaligned scatterlist: ofst:%x length:%d\n",
6969
data->sg->offset, data->sg->length);
7070
return -EINVAL;
7171
}
7272
}
7373

74-
if (!IS_ALIGNED(data->sg->offset, sizeof(u32))) {
74+
if (!IS_ALIGNED(sg->offset, sizeof(u32))) {
7575
dev_err(mmc_dev(host->mmc),
7676
"unaligned last scatterlist: ofst:%x length:%d\n",
7777
data->sg->offset, data->sg->length);

0 commit comments

Comments
 (0)