[U-Boot] [PATCH 2/2] ahci: dm: Fix memory allocation for uclass private data

Jean-Jacques Hiblot jjhiblot at ti.com
Fri Jul 7 10:13:35 UTC 2017


Allocate manually the uclass private data in ahci_init_dm(). Don't do this
in the declaration of the scsi uclass driver with
.per_device_auto_alloc_size because it is AHCI specific.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
---
 drivers/ata/ahci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 6da412d..1d88472 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1090,7 +1090,13 @@ int ahci_init(void __iomem *base)
 
 int ahci_init_dm(struct udevice *dev, void __iomem *base)
 {
-	struct ahci_uc_priv *uc_priv = dev_get_uclass_priv(dev);
+	struct ahci_uc_priv *uc_priv;
+
+	uc_priv = calloc(1, sizeof(struct ahci_uc_priv));
+	if (!uc_priv)
+		return -ENOMEM;
+
+	dev->uclass_priv = uc_priv;
 
 	return ahci_init_common(uc_priv, base);
 }
-- 
1.9.1



More information about the U-Boot mailing list