Skip to contentSkip to conversation

usb: ohci: ohci-da8xx: Cleanup Error handling and fix flags

PATCH New Adam Ford 2 participants 2 messages May 7, 2019 – May 10, 2019

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 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.

drivers/usb/host/ohci-da8xx.c +5 -4
index e8a495fde5..233df57b4d 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 usb: ohci: ohci-da8xx: Cleanup Error handling and fix flags

drivers/usb/host/ohci-da8xx.c

Quoted 9 lines · Adam Ford

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.

drivers/usb/host/ohci-da8xx.c +0 -0
index e8a495fde5..233df57b4d 100644

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190510/63fe881f/attachment.sig>