[U-Boot] [PATCH] mmc: dcache: Replace ext_csd buffer with cache aligned one

Andy Fleming afleming at gmail.com
Wed Aug 17 04:43:09 CEST 2011


On Fri, Aug 12, 2011 at 3:25 AM, Lukasz Majewski <l.majewski at samsung.com> wrote:
> This commit replaces the ext_csd buffer allocated as an automatic
> variable with one cache aligned. The ext_csd might be allocated with
> alignment not equal to the L1 D cache alignment.
>
> The memalign from common/dlmalloc.c is allowing for buffer allocation
> with proper cache alignment.
>
> The common/dlmalloc.c [c|m]alloc alignment is hardwired to 8 bytes,
> so out of the box functions cannot be safely used with L1 D cache.
>
> Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
> CC: Andy Fleming <afleming at gmail.com>
> CC: Albert ARIBAUD <albert.u.boot at aribaud.net>
> ---
>  drivers/mmc/mmc.c |   55 +++++++++++++++++++++++++++++++++-------------------
>  1 files changed, 35 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 7e703c0..422a0f9 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -660,7 +664,11 @@ int mmc_change_freq(struct mmc *mmc)
>        else
>                mmc->card_caps |= MMC_MODE_HS;
>
> -       return 0;
> + exit:
> +       err = 0;


Just initialize err to 0 at the beginning of the function, and relabel
"error" as "out"


> + error:
> +       free(ext_csd);
> +       return err;
>  }
>
>  int mmc_switch_part(int dev_num, unsigned int part_num)

> @@ -1122,6 +1134,9 @@ int mmc_startup(struct mmc *mmc)
>        init_part(&mmc->block_dev);
>
>        return 0;
> + error:
> +       free(ext_csd);

Need to remove that "return 0" so that ext_csd gets freed if things go
correctly, too. I would also relabel this one as "out", so as to not
confuse the casual reader.

Andy


More information about the U-Boot mailing list