There is a bug in the ST HAL_GPIO_DeInit() function in stm32f1xx_hal_gpio.c, where it uses the CLEAR_BIT() macro to perform a read-modify-write of the GPIOx->ODR register directly to clear some GPIO pins, as opposed to the better way of clearing them...