diff options
author | Wolfgang Grandegger <wg@aries-embedded.de> | 2022-03-14 09:32:53 +0100 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2022-03-14 12:31:12 +0100 |
commit | 2addee35f2da178bf858403f2e2cb20a59df734f (patch) | |
tree | ac0d157e9d272c998513384ac8ab43b233f738e1 /drivers/usb | |
parent | c96137000e4cf486dcb164fd67a1a0b5b2fb99c6 (diff) | |
download | u-boot-2addee35f2da178bf858403f2e2cb20a59df734f.tar.gz u-boot-2addee35f2da178bf858403f2e2cb20a59df734f.tar.bz2 u-boot-2addee35f2da178bf858403f2e2cb20a59df734f.zip |
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.
Signed-off-by: Wolfgang Grandegger <wg@aries-embedded.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/dwc2_udc_otg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 2748270ad6..77988f78ab 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -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) + plat->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) { |