Small correction in hal_xsnor_base.c Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
wolf
Posts: 42
Joined: Mon Dec 31, 2012 1:55 pm
Been thanked: 9 times

Small correction in hal_xsnor_base.c

Post by wolf »

chibios-code-r17707-trunk

Hi all,

compiling hal_xsnor_base.c gives below warning:

Code: Select all

Compiling hal_xsnor_base.c
../../chibios_trunk/os/hal/lib/complex/xsnor/src/hal_xsnor_base.c: In function 'xsnorStart':
../../chibios_trunk/os/hal/lib/complex/xsnor/src/hal_xsnor_base.c:909:10: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
  909 |   return err;
      |          ^~~
I think err should be initialized as shown below:

Code: Select all

/**
 * @brief       Configures and activates a SNOR driver.
 *
 * @param[in,out] ip            Pointer to a @p hal_xsnor_base_c instance.
 * @param[in]     config        Pointer to the configuration.
 * @return                      An error code.
 * @retval FLASH_NO_ERROR       Operation successful.
 * @retval FLASH_ERROR_HW_FAILURE If initialization failed.
 *
 * @api
 */
flash_error_t xsnorStart(void *ip, const xsnor_config_t *config) {
  hal_xsnor_base_c *self = (hal_xsnor_base_c *)ip;
  flash_error_t err = FLASH_NO_ERROR;
Best regards,
Wolf
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Small correction in hal_xsnor_base.c

Post by Giovanni »

Hi,

Fixed in trunk, thanks.

Giovanni
Post Reply