mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
USB: at91: at91-ohci: fix set/get power
in commit aa6e52a35 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: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Acked-by: Thomas Petazzoni <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
5dc2470c60
commit
770f0baaee
1 changed files with 6 additions and 0 deletions
|
|
@ -223,6 +223,9 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
|
|||
if (port < 0 || port >= 2)
|
||||
return;
|
||||
|
||||
if (pdata->vbus_pin[port] <= 0)
|
||||
return;
|
||||
|
||||
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)
|
|||
if (port < 0 || port >= 2)
|
||||
return -EINVAL;
|
||||
|
||||
if (pdata->vbus_pin[port] <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue