Skip to content

Commit 1596cc5

Browse files
congnguyenhuukartben
authored andcommitted
drivers: flash-nxp-s32-qspi: ignore flash operations with zero size
The current shim driver for flash-nxp-s32-qspi returns invalid error when handling write, erase operations with zero size. This issue causes the failure of the tests/subsys/settings/fcb/. Updated to ignore the flash operations with zero size instead of. Signed-off-by: Cong Nguyen Huu <[email protected]>
1 parent 28c2521 commit 1596cc5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/flash/flash_nxp_s32_qspi.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 NXP
2+
* Copyright 2023-2025 NXP
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -93,7 +93,11 @@ int nxp_s32_qspi_write(const struct device *dev, off_t offset, const void *src,
9393
size_t len;
9494
int ret = 0;
9595

96-
if (!src || !size) {
96+
if (!size) {
97+
return 0;
98+
}
99+
100+
if (!src) {
97101
return -EINVAL;
98102
}
99103

@@ -187,7 +191,11 @@ int nxp_s32_qspi_erase(const struct device *dev, off_t offset, size_t size)
187191
size_t erase_size;
188192
int ret = 0;
189193

190-
if (!area_is_subregion(dev, offset, size) || !size) {
194+
if (!size) {
195+
return 0;
196+
}
197+
198+
if (!area_is_subregion(dev, offset, size)) {
191199
return -EINVAL;
192200
}
193201

0 commit comments

Comments
 (0)