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@xxxxxxxxx> --- drivers/usb/host/ehci-hcd.c | 28 ++++++++++++++-------------- 1 file 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); -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox