Skip to contentSkip to conversation

usb: dwc2: handle return code of dev_read_size() in of to, plat function

PATCH Applied Wolfgang Grandegger 2 participants 4 messages Mar 13, 2022 – Mar 14, 2022 USB

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: dwc2: handle return code of dev_read_size() in of to, plat function

dev_read_size() returns -EINVAL (-22) if the property "g-tx-fifo-size" does not exist. If that's the case, we now keep the default value of 0.

---
Changes since v1:
- removed unrelated changes (missing empty line)
- improved commit message

 drivers/usb/gadget/dwc2_udc_otg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/gadget/dwc2_udc_otg.c +3 -2
index 2748270..12e91bb 100644
@@ -996,8 +996,9 @@ static int dwc2_udc_otg_of_to_plat(struct udevice *dev)
 	plat->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0);
 	plat->np_tx_fifo_sz = dev_read_u32_default(dev, "g-np-tx-fifo-size", 0);
 
-	plat->tx_fifo_sz_nb =
-		dev_read_size(dev, "g-tx-fifo-size") / sizeof(u32);
+	ret = dev_read_size(dev, "g-tx-fifo-size");
+	if (ret > 0)
+		platdata->tx_fifo_sz_nb = ret / sizeof(u32);
 	if (plat->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS)
 		plat->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS;
 	if (plat->tx_fifo_sz_nb) {
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 2 lines · Wolfgang Grandegger

dev_read_size() returns -EINVAL (-22) if the property "g-tx-fifo-size" does not exist. If that's the case, we now keep the default value of 0.

Applied, thanks.

#3 lore raw

Am 13.03.22 um 15:11 schrieb Marek Vasut:

Quoted 10 lines · Marek Vasut
Quoted 5 lines · Wolfgang Grandegger
Quoted 2 lines

dev_read_size() returns -EINVAL (-22) if the property "g-tx-fifo-size" does not exist. If that's the case, we now keep the default value of 0.

Applied, thanks.

The patch does not even compile, please fix:

https://source.denx.de/u-boot/custodians/u-boot-usb/-/pipelines/11256

Argh, sorry, the patch was for v2020.v1, accidentally! I have just sent v3.

Thanks,

Wolfgang