Skip to content

Commit 4f34e21

Browse files
tpwrulestridge
authored andcommitted
SDMMCv1: finish bouncebuffer use after error cleanup
The error routine ensures DMA use is finished, which is a requirement before we finish with the bouncebuffer.
1 parent ac078e5 commit 4f34e21

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,8 @@ bool sdc_lld_read_special(SDCDriver *sdcp, uint8_t *buf, size_t bytes,
836836
return HAL_SUCCESS;
837837

838838
error:
839-
bouncebuffer_finish_read(sdcp->bouncebuffer, buf, bytes);
840839
sdc_lld_error_cleanup(sdcp, 1, resp);
840+
bouncebuffer_finish_read(sdcp->bouncebuffer, buf, bytes);
841841
return HAL_FAILED;
842842
}
843843

@@ -905,8 +905,8 @@ bool sdc_lld_read_aligned(SDCDriver *sdcp, uint32_t startblk,
905905
return HAL_SUCCESS;
906906

907907
error:
908-
bouncebuffer_finish_read(sdcp->bouncebuffer, buf, blocks * MMCSD_BLOCK_SIZE);
909908
sdc_lld_error_cleanup(sdcp, blocks, resp);
909+
bouncebuffer_finish_read(sdcp->bouncebuffer, buf, blocks * MMCSD_BLOCK_SIZE);
910910
return HAL_FAILED;
911911
}
912912

@@ -974,8 +974,8 @@ bool sdc_lld_write_aligned(SDCDriver *sdcp, uint32_t startblk,
974974
return HAL_SUCCESS;
975975

976976
error:
977-
bouncebuffer_finish_write(sdcp->bouncebuffer, buf);
978977
sdc_lld_error_cleanup(sdcp, blocks, resp);
978+
bouncebuffer_finish_write(sdcp->bouncebuffer, buf);
979979
return HAL_FAILED;
980980
}
981981

0 commit comments

Comments
 (0)