Merge pull request #10653 from desowin/stm-usb-host

STM USBHALHost: Fix NULL pointer dereference
pull/10776/head
Martin Kojtal 2019-06-09 18:01:46 +01:00 committed by GitHub
commit df84eb1b28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -122,10 +122,14 @@ static gpio_t gpio_powerpin;
void usb_vbus(uint8_t state)
{
if (state == 0) {
gpio_write(&gpio_powerpin, USB_POWER_OFF);
if (gpio_powerpin.reg_set && gpio_powerpin.reg_clr) {
if (state == 0) {
gpio_write(&gpio_powerpin, USB_POWER_OFF);
} else {
gpio_write(&gpio_powerpin, USB_POWER_ON);
}
} else {
gpio_write(&gpio_powerpin, USB_POWER_ON);
/* The board does not have GPIO pin to control usb supply */
}
wait(0.2);
}