[PATCH v4 19/19] usb: ohci-at91: Add `ohci_t` field in `ohci_at91_priv`

Sergiu Moga sergiu.moga at microchip.com
Mon Dec 19 09:46:27 CET 2022


From: Cristian Birsan <cristian.birsan at microchip.com>

The `ohci_register` function expects that the OHCI driver's
priv is a struct whose first field is of type `ohci_t`.
The original conversion to DM did not have it and this
inconsistency revealed itself whenever U-Boot required
multiple memory allocations resulting in a memory overwrite
of where this field would supposedly be.

Thus, add this missing field and automatically increase
the implicit size of the driver's priv to avoid whatever
future memory allocations may take place from overwriting
it.

Fixes: de1cf0a9c6 ("drivers: usb: ohci-at91: Enable OHCI functionality and register into DM")
Signed-off-by: Cristian Birsan <cristian.birsan at microchip.com>
Signed-off-by: Sergiu Moga <sergiu.moga at microchip.com>
Tested-by: Mihai Sain <mihai.sain at microchip.com>
---



v1 -> v4:
- No change



 drivers/usb/host/ohci-at91.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 4b1aff4127..0791769026 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -90,6 +90,7 @@ struct at91_usbh_data {
 };
 
 struct ohci_at91_priv {
+	ohci_t ohci;
 	struct clk *iclk;
 	struct clk *fclk;
 	struct clk *hclk;
-- 
2.34.1



More information about the U-Boot mailing list