From: Simon Glass Date: Tue, 4 Jul 2017 19:31:22 +0000 (-0600) Subject: dm: ahci: Correct uclass private data X-Git-Tag: v2017.09-rc2~136^2~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bfc1c6b4838501d10aa48c0e92eaf70976f4b2dd;p=u-boot dm: ahci: Correct uclass private data This is expected to be attached to the uclass and the code operates that way, but the uclass has not been updated. Fix it to avoid using memory at address 0. Signed-off-by: Simon Glass Fixes: 47fc61a (dm: ahci: Drop use of probe_ent) --- diff --git a/drivers/ata/ahci-uclass.c b/drivers/ata/ahci-uclass.c index 7b8c32699f..71600fed68 100644 --- a/drivers/ata/ahci-uclass.c +++ b/drivers/ata/ahci-uclass.c @@ -6,9 +6,11 @@ */ #include +#include #include UCLASS_DRIVER(ahci) = { .id = UCLASS_AHCI, .name = "ahci", + .per_device_auto_alloc_size = sizeof(struct ahci_uc_priv), }; diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 7c56f57bfd..5e4df19386 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -935,7 +935,7 @@ static int ahci_scsi_exec(struct udevice *dev, struct scsi_cmd *pccb) { struct ahci_uc_priv *uc_priv; #ifdef CONFIG_DM_SCSI - uc_priv = dev_get_uclass_priv(dev); + uc_priv = dev_get_uclass_priv(dev->parent); #else uc_priv = probe_ent; #endif