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

Simon Glass sjg at chromium.org
Fri Jul 28 04:19:53 UTC 2017


Hi,

On 19 July 2017 at 04:57, Jean-Jacques Hiblot <jjhiblot at ti.com> wrote:
> 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>
> ---
>
> Since the last merge of u-boot-dm, the DM driver for AHCI on OMAP5 paltforms is
> broken. This patche fixes the issue. It had previsouly been sent as part of a
> series "dm: ahci: Fix dwc_ahci".
>
> Jean-Jacques
>
>
>
>  drivers/ata/ahci.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

This should be fixed in patches that are pending. Can you please check
 u-boot-dm/ata2-working?

Also we should not allocate the private data - DM does it automatically.

>
> 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
>

Regards,
Simon


More information about the U-Boot mailing list