[U-Boot] [PATCH 2/4] fsl_*_serdes.c: Modify memset call in serdes_init

Bin Meng bmeng.cn at gmail.com
Sun Nov 29 10:34:28 CET 2015


On Sat, Nov 28, 2015 at 9:04 PM, Tom Rini <trini at konsulko.com> wrote:
> GCC 5.x does not like sizeof(array_variable) and errors out.  Change these
> calls to be instead sizeof(u8) (as that's what serdes_prtcl_map is) *
> SERDES_PRCTL_COUNT (the number of array elements).
>
> Cc: York Sun <yorksun at freescale.com>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c | 2 +-
>  arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c | 2 +-
>  arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c       | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c
> index f7178d1..fe3444a 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c
> @@ -86,7 +86,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
>         u32 cfg;
>         int lane;
>
> -       memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
> +       memset(serdes_prtcl_map, 0, sizeof(u8) * SERDES_PRCTL_COUNT);
>
>         cfg = gur_in32(&gur->rcwsr[4]) & sd_prctl_mask;
>         cfg >>= sd_prctl_shift;
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
> index 2ab8da6..4f6b601 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
> @@ -74,7 +74,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
>         u32 cfg;
>         int lane;
>
> -       memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
> +       memset(serdes_prtcl_map, 0, sizeof(u8) * SERDES_PRCTL_COUNT);
>
>         cfg = gur_in32(&gur->rcwsr[28]) & sd_prctl_mask;
>         cfg >>= sd_prctl_shift;
> diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
> index acb1353..b439b5b 100644
> --- a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
> +++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
> @@ -184,7 +184,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
>         u32 cfg;
>         int lane;
>
> -       memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
> +       memset(serdes_prtcl_map, 0, sizeof(u8) * SERDES_PRCTL_COUNT);
>  #ifdef CONFIG_SYS_FSL_ERRATUM_A007186
>         struct ccsr_sfp_regs  __iomem *sfp_regs =
>                         (struct ccsr_sfp_regs __iomem *)(CONFIG_SYS_SFP_ADDR);
> --

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list