]> git.sur5r.net Git - u-boot/commitdiff
dm: ahci: Correct uclass private data
authorSimon Glass <sjg@chromium.org>
Tue, 4 Jul 2017 19:31:22 +0000 (13:31 -0600)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 1 Aug 2017 02:58:01 +0000 (11:58 +0900)
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 <sjg@chromium.org>
Fixes: 47fc61a (dm: ahci: Drop use of probe_ent)
drivers/ata/ahci-uclass.c
drivers/ata/ahci.c

index 7b8c32699f534abd1c626dac18dfa796aabcdc52..71600fed68553bb82ff838ff99f798dbf8a7ff4e 100644 (file)
@@ -6,9 +6,11 @@
  */
 
 #include <common.h>
+#include <ahci.h>
 #include <dm.h>
 
 UCLASS_DRIVER(ahci) = {
        .id             = UCLASS_AHCI,
        .name           = "ahci",
+       .per_device_auto_alloc_size = sizeof(struct ahci_uc_priv),
 };
index 7c56f57bfdef5eb70268296158323a124d12514b..5e4df19386bdf4832eeabd7543ef69772eb1ea57 100644 (file)
@@ -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