diff options
author | Denis Orlov <denorl2009@gmail.com> | 2022-03-01 12:14:23 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-03-08 09:57:59 +0100 |
commit | 3a74a01a44eb794e604651ab969432df30570359 (patch) | |
tree | 3ed1e5ea8f2cce09ed391ff83378434dc4d75a03 /drivers/usb | |
parent | 74cb01acec32b526104b2761368711a41d7a30a3 (diff) | |
download | barebox-3a74a01a44eb794e604651ab969432df30570359.tar.gz barebox-3a74a01a44eb794e604651ab969432df30570359.tar.xz |
usb: host: ehci: reorder code in ehci_probe()
Currently, after successful memory region requests the driver
initialization could still fail, leaving those regions allocated. By
reordering the code those requests can be placed later, after the
possibly failing calls.
Signed-off-by: Denis Orlov <denorl2009@gmail.com>
Link: https://lore.barebox.org/20220301091423.19871-2-denorl2009@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index facfb3a95b..068504557b 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1421,20 +1421,6 @@ static int ehci_probe(struct device_d *dev) */ data.flags = EHCI_HAS_TT; - iores = dev_request_mem_resource(dev, 0); - if (IS_ERR(iores)) - return PTR_ERR(iores); - data.hccr = IOMEM(iores->start); - - if (dev->num_resources > 1) { - iores = dev_request_mem_resource(dev, 1); - if (IS_ERR(iores)) - return PTR_ERR(iores); - data.hcor = IOMEM(iores->start); - } - else - data.hcor = NULL; - usb2_generic_phy = phy_optional_get(dev, "usb"); if (IS_ERR(usb2_generic_phy)) return PTR_ERR(usb2_generic_phy); @@ -1456,6 +1442,20 @@ static int ehci_probe(struct device_d *dev) if (ret) return ret; + iores = dev_request_mem_resource(dev, 0); + if (IS_ERR(iores)) + return PTR_ERR(iores); + data.hccr = IOMEM(iores->start); + + if (dev->num_resources > 1) { + iores = dev_request_mem_resource(dev, 1); + if (IS_ERR(iores)) + return PTR_ERR(iores); + data.hcor = IOMEM(iores->start); + } + else + data.hcor = NULL; + ehci = ehci_register(dev, &data); if (IS_ERR(ehci)) return PTR_ERR(ehci); |