From 2cb47d201079feea66a91a9a8f6ed2136bbbedb8 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Thu, 23 Oct 2025 15:28:19 -0500 Subject: [PATCH] bsps/jffs2_flashdev: Return correct value for OOB size Return the actual out of bounds size per page instead of the ioctl return status. JFFS2 will happily operate with an OOB size of 0 and instead put cleanmarkers in the normal page space of the flash. --- bsps/shared/dev/flash/jffs2_flashdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bsps/shared/dev/flash/jffs2_flashdev.c b/bsps/shared/dev/flash/jffs2_flashdev.c index 47ca4a2128..f5a323c83e 100644 --- a/bsps/shared/dev/flash/jffs2_flashdev.c +++ b/bsps/shared/dev/flash/jffs2_flashdev.c @@ -179,10 +179,17 @@ static uint32_t do_get_oob_size( rtems_jffs2_flash_control *super ) { + int rv; int fd = fileno(get_flash_control( super )->handle); size_t bytes_per_page = 0; - return ioctl(fd, RTEMS_FLASHDEV_IOCTL_OOB_BYTES_PER_PAGE, &bytes_per_page); + rv = ioctl(fd, RTEMS_FLASHDEV_IOCTL_OOB_BYTES_PER_PAGE, &bytes_per_page); + + if (rv != 0) { + return 0; + } + + return bytes_per_page; } static void do_destroy( rtems_jffs2_flash_control *super )