CHROMIUM: USB: ohci-exynos: initialize registers pointer earlier
authorVincent Palatin <vpalatin@chromium.org>
Mon, 29 Oct 2012 18:54:14 +0000 (11:54 -0700)
committerGerrit <chrome-bot@google.com>
Wed, 31 Oct 2012 23:37:50 +0000 (16:37 -0700)
commit94a0c3642c39b74b81edeed5fb6a278c71d3d892
treeb00ba13c6ad9d477ecc8497e3c7012cae3e7bcc3
parent783b3fe2d64e3a3d35ee30e4eccee29c91ce107c
CHROMIUM: USB: ohci-exynos: initialize registers pointer earlier

In the former code, we have a race condition between the first interrupt
and the regs field initilization in the usb_hcd structure.
If the OHCI irq fires before hcd->regs is set, we are getting a null
pointer dereference in ohci_irq.

When calling usb_add_hcd(), it first executes the reset() callback,
then enables the ohci interrupt, and finally executes the start()
callback. So moving the ohci_init() call which actually initializes the
reg field from start() to reset() should remove the race.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:15731
TEST=run on Spring with USB2.0 on internal PHY on HSIC hub initialized
in the bootloader, and see no kernel panic at startup.

Change-Id: If98070a3cd16b7f735c8cfb62c20cebf410953d2
Reviewed-on: https://gerrit.chromium.org/gerrit/36823
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
drivers/usb/host/ohci-exynos.c