提交 b404299f 编写于 作者: O Oliver Neukum 提交者: Greg Kroah-Hartman

USB: power availability check for berry_charge

this introduces a sanity check into berry_charge to give up before
damage is done if we lack juice.
Signed-off-by: NOliver Neukum <oneukum@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 ff8973d9
......@@ -123,6 +123,11 @@ static int berry_probe(struct usb_interface *intf,
{
struct usb_device *udev = interface_to_usbdev(intf);
if (udev->bus_mA < 500) {
dbg(&udev->dev, "Not enough power to charge available\n");
return -ENODEV;
}
dbg(&udev->dev, "Power is set to %dmA\n",
udev->actconfig->desc.bMaxPower * 2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册