@@ -247,8 +247,12 @@ int QSPIFBlockDevice::init()
247247 }
248248
249249 // Configure BUS Mode to 1_1_1 for all commands other than Read
250- _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
251- 0 , QSPI_CFG_BUS_SINGLE, 0 );
250+ if (QSPI_STATUS_OK != _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
251+ 0 , QSPI_CFG_BUS_SINGLE, 0 )) {
252+ tr_error (" _qspi_configure_format failed" );
253+ status = QSPIF_BD_ERROR_DEVICE_ERROR;
254+ goto exit_point;
255+ }
252256
253257 _is_initialized = true ;
254258
@@ -303,19 +307,29 @@ int QSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
303307 _mutex.lock ();
304308
305309 // Configure Bus for Reading
306- _qspi_configure_format (_inst_width, _address_width, _address_size, _address_width, // Alt width == address width
307- _alt_size, _data_width, _dummy_cycles);
310+ if (QSPI_STATUS_OK != _qspi_configure_format (_inst_width, _address_width, _address_size, _address_width, // Alt width == address width
311+ _alt_size, _data_width, _dummy_cycles)) {
312+ tr_error (" _qspi_configure_format failed" );
313+ status = QSPIF_BD_ERROR_DEVICE_ERROR;
314+ goto exit_point;
315+ }
308316
309317 if (QSPI_STATUS_OK != _qspi_send_read_command (_read_instruction, buffer, addr, size)) {
310- status = QSPIF_BD_ERROR_DEVICE_ERROR;
311318 tr_error (" Read Command failed" );
319+ status = QSPIF_BD_ERROR_DEVICE_ERROR;
320+ goto exit_point;
312321 }
313322
314323 // All commands other than Read use default 1-1-1 Bus mode (Program/Erase are constrained by flash memory performance more than bus performance)
315- _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
316- 0 , QSPI_CFG_BUS_SINGLE, 0 );
324+ if (QSPI_STATUS_OK != _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE, 0 , QSPI_CFG_BUS_SINGLE, 0 )) {
325+ tr_error (" _qspi_configure_format failed" );
326+ status = QSPIF_BD_ERROR_DEVICE_ERROR;
327+ goto exit_point;
328+ }
317329
330+ exit_point:
318331 _mutex.unlock ();
332+
319333 return status;
320334
321335}
@@ -718,8 +732,11 @@ int QSPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_
718732 bd_addr_t addr = 0x0 ;
719733
720734 // Set 1-1-1 bus mode for SFDP header parsing
721- _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
722- 0 , QSPI_CFG_BUS_SINGLE, 8 );
735+ if (QSPI_STATUS_OK != _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
736+ 0 , QSPI_CFG_BUS_SINGLE, 8 )) {
737+ tr_error (" _qspi_configure_format failed" );
738+ return -1 ;
739+ }
723740
724741 qspi_status_t status = _qspi_send_read_command (QSPIF_SFDP, (char *)sfdp_header, addr /* address*/ , data_length);
725742 if (status != QSPI_STATUS_OK) {
@@ -885,8 +902,11 @@ int QSPIFBlockDevice::_sfdp_set_quad_enabled(uint8_t *basic_param_table_ptr)
885902 }
886903
887904 // Configure BUS Mode to 1_1_1 for all commands other than Read
888- _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
889- 0 , QSPI_CFG_BUS_SINGLE, 0 );
905+ if (QSPI_STATUS_OK != _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
906+ 0 , QSPI_CFG_BUS_SINGLE, 0 )) {
907+ tr_error (" _qspi_configure_format failed" );
908+ return -1 ;
909+ }
890910
891911 // Read Status Register
892912 if (QSPI_STATUS_OK == _qspi_send_general_command (_read_register_inst, QSPI_NO_ADDRESS_COMMAND, NULL , 0 ,
@@ -1211,8 +1231,11 @@ int QSPIFBlockDevice::_enable_fast_mdoe()
12111231 status_reg_qer_setup[2 ] = 0x2 ; // Bit 1 of config Reg 2
12121232
12131233 // Configure BUS Mode to 1_1_1 for all commands other than Read
1214- _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
1215- 0 , QSPI_CFG_BUS_SINGLE, 0 );
1234+ if (QSPI_STATUS_OK != _qspi_configure_format (QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
1235+ 0 , QSPI_CFG_BUS_SINGLE, 0 )) {
1236+ tr_error (" _qspi_configure_format failed" );
1237+ return QSPIF_BD_ERROR_DEVICE_ERROR;
1238+ }
12161239
12171240 // Read Status Register
12181241 if (QSPI_STATUS_OK == _qspi_send_general_command (read_conf_register_inst, QSPI_NO_ADDRESS_COMMAND, NULL , 0 ,
0 commit comments