]> git.sur5r.net Git - u-boot/commitdiff
usb: ehci-hcd: Fix crash when no ops are provided to ehci_register()
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Sun, 3 Apr 2016 11:38:26 +0000 (13:38 +0200)
committerMarek Vasut <marex@denx.de>
Sun, 10 Apr 2016 15:18:42 +0000 (17:18 +0200)
This commit fixes crash on BananaPi (and possibly others)
casued by 3f9f8a5b83f8aec40c9f4ee496046a695e333c45.

Crash reason:
When no ops were passed to ehci_register(), USB host driver caused
NULL pointer dereference.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
drivers/usb/host/ehci-hcd.c

index 598f444504b7e82fe5eb13cc9d50c4bc382e1ebe..fa5d584b82e4a4c7f61168436049fa1d267a58a0 100644 (file)
@@ -1615,8 +1615,8 @@ int ehci_register(struct udevice *dev, struct ehci_hccr *hccr,
        if (ret)
                goto err;
 
-       if (ops->init_after_reset) {
-               ret = ops->init_after_reset(ctrl);
+       if (ctrl->ops.init_after_reset) {
+               ret = ctrl->ops.init_after_reset(ctrl);
                if (ret)
                        goto err;
        }