diff options
author | Adam Ford | 2019-05-07 06:57:39 -0500 |
---|---|---|
committer | Tom Rini | 2019-05-09 19:52:55 -0400 |
commit | 3a90b50a32b6b8a2d66dc10c19e3c15d5bd1a092 (patch) | |
tree | f83c7bf586af88cc5d97dbd3e13496970d2fef54 | |
parent | 80af0fed237aca17e1d32625a77426dbd49cf47f (diff) |
usb: ohci: ohci-da8xx: Cleanup Error handling and fix flags
Per feedback from Marek, he suggested better handling and
to enable DM_FLAG_OS_PREPARE, this patch re-orders some of
the error checking, and errors returns the error code right
away and also sets DM_FLAG_OS_PREPARE.
Signed-off-by: Adam Ford <aford173@gmail.com>
-rw-r--r-- | drivers/usb/host/ohci-da8xx.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index e8a495fde59..233df57b4da 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -93,6 +93,10 @@ static int ohci_da8xx_probe(struct udevice *dev) err = 0; priv->clock_count = 0; clock_nb = dev_count_phandle_with_args(dev, "clocks", "#clock-cells"); + + if (clock_nb < 0) + return clock_nb; + if (clock_nb > 0) { priv->clocks = devm_kcalloc(dev, clock_nb, sizeof(struct clk), GFP_KERNEL); @@ -112,9 +116,6 @@ static int ohci_da8xx_probe(struct udevice *dev) } priv->clock_count++; } - } else if (clock_nb != -ENOENT) { - dev_err(dev, "failed to get clock phandle(%d)\n", clock_nb); - return clock_nb; } err = usb_cpu_init(); @@ -170,6 +171,6 @@ U_BOOT_DRIVER(ohci_generic) = { .remove = ohci_da8xx_remove, .ops = &ohci_usb_ops, .priv_auto_alloc_size = sizeof(struct da8xx_ohci), - .flags = DM_FLAG_ALLOC_PRIV_DMA, + .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE, }; #endif |