提交 770f0baa 编写于 作者: J Jean-Christophe PLAGNIOL-VILLARD 提交者: Greg Kroah-Hartman

USB: at91: at91-ohci: fix set/get power

in commit aa6e52a3 we introduce the support of overcurrent notification
but the set and get of the power without checking if the gpio is valid or not
Signed-off-by: NJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 5dc2470c
...@@ -223,6 +223,9 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int ...@@ -223,6 +223,9 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
if (port < 0 || port >= 2) if (port < 0 || port >= 2)
return; return;
if (pdata->vbus_pin[port] <= 0)
return;
gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable);
} }
...@@ -231,6 +234,9 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) ...@@ -231,6 +234,9 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
if (port < 0 || port >= 2) if (port < 0 || port >= 2)
return -EINVAL; return -EINVAL;
if (pdata->vbus_pin[port] <= 0)
return -EINVAL;
return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册