diff mbox

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

Message ID 1499422415-31401-3-git-send-email-jjhiblot@ti.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Jean-Jacques Hiblot July 7, 2017, 10:13 a.m. UTC
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@ti.com>
---
 drivers/ata/ahci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

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);
 }