[U-Boot] [PATCH] ddr:fsl: Fix warnings on gcc-6.x
york sun
york.sun at nxp.com
Fri Feb 10 16:45:12 UTC 2017
On 02/09/2017 03:10 PM, Tom Rini wrote:
> With gcc-6.x we will see many warnings like:
> warning: ‘dual_0S’ defined but not used [-Wunused-const-variable=]
>
> Depending on exactly what DDR choices are or are not enabled when we use
> this file. So we use slightly more exact #ifdef tests in order to
> silence the warnings.
>
> Reported-by: Thomas Schaefer <Thomas.Schaefer at kontron.com>
> Cc: York Sun <york.sun at nxp.com>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
> drivers/ddr/fsl/options.c | 27 ++++++++++++++++++++++++---
> 1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> index d6a8fcb216a4..7f7c16ced6f3 100644
> --- a/drivers/ddr/fsl/options.c
> +++ b/drivers/ddr/fsl/options.c
> @@ -29,10 +29,12 @@ struct dynamic_odt {
> unsigned int odt_rtt_wr;
> };
>
> -#ifdef CONFIG_SYS_FSL_DDR4
> +#if defined(CONFIG_SYS_FSL_DDR4) && defined(CONFIG_DIMM_SLOTS_PER_CTLR)
> /* Quad rank is not verified yet due availability.
> * Replacing 20 OHM with 34 OHM since DDR4 doesn't have 20 OHM option
> */
> +#if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) || ((CONFIG_DIMM_SLOTS_PER_CTLR == 2) && \
> + defined(CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE))
> static const struct dynamic_odt single_Q[4] = {
> { /* cs0 */
> FSL_DDR_ODT_NEVER,
> @@ -59,7 +61,9 @@ static const struct dynamic_odt single_Q[4] = {
> DDR4_RTT_120_OHM
> }
> };
> +#endif
>
> +#if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
> static const struct dynamic_odt single_D[4] = {
> { /* cs0 */
> FSL_DDR_ODT_NEVER,
> @@ -89,6 +93,8 @@ static const struct dynamic_odt single_S[4] = {
> {0, 0, 0, 0},
> };
>
> +#elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
> +
<snip>
Tom,
What do you think about using __maybe_unused instead? As Thomas Schaefer
has verified that GCC optimized out unused constants.
York
More information about the U-Boot
mailing list