bch: specify the alignment of bch buffer by CONFIG_BCH_BUFFER_ALIGNMENT
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
f81ffb51cc
commit
befad07fd4
@ -24,4 +24,8 @@ config BCH_ENCRYPTION_KEY_SIZE
|
||||
default 16
|
||||
depends on BCH_ENCRYPTION
|
||||
|
||||
config BCH_BUFFER_ALIGNMENT
|
||||
int "Buffer aligned bytes"
|
||||
default 0
|
||||
|
||||
endif # BCH
|
||||
|
@ -112,7 +112,11 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
|
||||
/* Allocate the sector I/O buffer */
|
||||
|
||||
bch->buffer = (FAR uint8_t *)kmm_malloc(bch->sectsize);
|
||||
#if CONFIG_BCH_BUFFER_ALIGNMENT != 0
|
||||
bch->buffer = kmm_memalign(CONFIG_BCH_BUFFER_ALIGNMENT, bch->sectsize);
|
||||
#else
|
||||
bch->buffer = kmm_malloc(bch->sectsize);
|
||||
#endif
|
||||
if (!bch->buffer)
|
||||
{
|
||||
ferr("ERROR: Failed to allocate sector buffer\n");
|
||||
|
Loading…
Reference in New Issue
Block a user