[U-Boot] [PATCH 00/12] Fix GCC 6.2 compiler warnings

More or less by accident I ran buildman the other day on a box with GCC 6.2.0 cross-compilers. By default it seems that the 6.x series enables more (and new) warnings, so the results were non-clean builds for about two thirds of the armv8 defconfigs. Some of the warnings are cosmectic, but some are genuine bugs (mostly in error handling cases, but still). This is a first bunch of fixes, shamelessly picking the low hanging fruits here. I fixed even the cases where the code itself was correct, to avoid warnings and also not to confuse any readers of the code. Also getting used to ignore warnings leads to eventually missing that one genuine one in the future (been there ...)
In a few cases I made a guess on the fix, please feel free to correct me in the (likely) case I got it wrong.
Applies on top of v2016.11 release.
Cheers, Andre.
P.S. Almost every Freescale board build still complains along the lines of [1]. I spent some time in that file (drivers/ddr/fsl/options.c) and narrowly escaped before I lost the remaining bits of my sanity to the daemons of #ifdef hell. If someone more familiar with that code could take a look and decide whether those definitions either belong into some #ifdef clauses or they should be attributed with __maybe_unused.
[1] http://pastebin.com/TrLSssqU
Andre Przywara (12): ls2080aqds: eth: add missing braces mtd: cfi_flash: fix indentation net: e1000: fix indentation net: ldpaa_eth: add missing braces net: rtl8169: remove unneeded definition marvell: comphy_a3700: fix bitmask usb: eth: r8152_fw: fix indentation davinci: da8xxevm: fix indentation phy: micrel: add missing braces cmd: tpm_test: fix indentation Xilinx ZynqMP: fix minimum SDHCI frequency usb: gadget: remove unused shortname variable
board/davinci/da8xxevm/da850evm.c | 4 ++-- board/freescale/ls2080aqds/eth.c | 3 ++- cmd/tpm_test.c | 4 ++-- drivers/mtd/cfi_flash.c | 4 ++-- drivers/net/e1000.c | 5 ++--- drivers/net/ldpaa_eth/ldpaa_eth.c | 3 ++- drivers/net/phy/micrel.c | 3 ++- drivers/net/rtl8169.c | 3 --- drivers/phy/marvell/comphy_a3700.h | 4 ++-- drivers/usb/eth/r8152_fw.c | 8 ++++---- drivers/usb/gadget/ether.c | 1 - include/configs/xilinx_zynqmp_ep.h | 2 +- 12 files changed, 21 insertions(+), 23 deletions(-)

The whole error message should be within the else clause, not just the first part. Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- board/freescale/ls2080aqds/eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index 95ff68b..7bf7a5b 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -196,12 +196,13 @@ static void sgmii_configure_repeater(int serdes_port) value); i = 5; j = 5; - } else + } else { printf("DPMAC %d :PHY is failed to ", dpmac_id); printf("configure the repeater 0x%x\n", value); } + } } } error:

On 11/15/2016 04:52 PM, Andre Przywara wrote:
The whole error message should be within the else clause, not just the first part. Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
board/freescale/ls2080aqds/eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index 95ff68b..7bf7a5b 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -196,12 +196,13 @@ static void sgmii_configure_repeater(int serdes_port) value); i = 5; j = 5;
} else
} else { printf("DPMAC %d :PHY is failed to ", dpmac_id); printf("configure the repeater 0x%x\n", value); }
} }}
error:
Thanks for finding this. This is being addressed by http://patchwork.ozlabs.org/patch/682885/. Currently in my test queue.
York

The indentation is misleading here and suggests that the write command will be only executed in the else clause. It seems like this is not intended, so fix the indentation to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 33c4a93..e036b88 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1456,8 +1456,8 @@ static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) cmd = FLASH_CMD_PROTECT_SET; else cmd = FLASH_CMD_PROTECT_CLEAR; - flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT); + + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); flash_write_cmd(info, sector, 0, cmd); /* re-enable interrupts if necessary */ if (flag)

On 16.11.2016 01:50, Andre Przywara wrote:
The indentation is misleading here and suggests that the write command will be only executed in the else clause. It seems like this is not intended, so fix the indentation to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan

On 11/15/2016 04:52 PM, Andre Przywara wrote:
The indentation is misleading here and suggests that the write command will be only executed in the else clause. It seems like this is not intended, so fix the indentation to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 33c4a93..e036b88 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1456,8 +1456,8 @@ static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) cmd = FLASH_CMD_PROTECT_SET; else cmd = FLASH_CMD_PROTECT_CLEAR;
flash_write_cmd(info, sector, 0,
FLASH_CMD_PROTECT);
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); flash_write_cmd(info, sector, 0, cmd); /* re-enable interrupts if necessary */ if (flag)
The new GCC can find this? Nice.
York

On Wed, Nov 16, 2016 at 12:50:06AM +0000, Andre Przywara wrote:
The indentation is misleading here and suggests that the write command will be only executed in the else clause. It seems like this is not intended, so fix the indentation to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Stefan Roese sr@denx.de
Applied to u-boot/master, thanks!

Apparently the indentation is off here, for the IGB model just want to bail out early. Fix this to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/net/e1000.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 3332ad9..875682b 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -1522,11 +1522,10 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw) reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1);
- /* IGB is cool */ - if (hw->mac_type == e1000_igb) - return;
switch (hw->mac_type) { + case e1000_igb: /* IGB is cool */ + return; case e1000_82571: case e1000_82572: /* Clear PHY TX compatible mode bits */

On Tue, Nov 15, 2016 at 6:50 PM, Andre Przywara andre.przywara@arm.com wrote:
Apparently the indentation is off here, for the IGB model just want to bail out early. Fix this to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/net/e1000.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 3332ad9..875682b 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -1522,11 +1522,10 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw) reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1);
/* IGB is cool */
if (hw->mac_type == e1000_igb)
return; switch (hw->mac_type) {
case e1000_igb: /* IGB is cool */
Too bad you didn't take this opportunity to drop the worthless comment. Oh well.
Acked-by: Joe Hershberger joe.hershberger@ni.com
return; case e1000_82571: case e1000_82572: /* Clear PHY TX compatible mode bits */
-- 2.8.2
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Wed, Nov 16, 2016 at 12:50:07AM +0000, Andre Przywara wrote:
Apparently the indentation is off here, for the IGB model just want to bail out early. Fix this to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

The error checking makes only sense if the previous line has been executed, so add block braces around the _whole_ then clause.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/net/ldpaa_eth/ldpaa_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c index 75b2b6b..4e61700 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.c +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c @@ -420,13 +420,14 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd) goto err_dpmac_setup;
#ifdef CONFIG_PHYLIB - if (priv->phydev) + if (priv->phydev) { err = phy_startup(priv->phydev); if (err) { printf("%s: Could not initialize\n", priv->phydev->dev->name); goto err_dpamc_bind; } + } #else priv->phydev = (struct phy_device *)malloc(sizeof(struct phy_device)); memset(priv->phydev, 0, sizeof(struct phy_device));

On 11/15/2016 04:52 PM, Andre Przywara wrote:
The error checking makes only sense if the previous line has been executed, so add block braces around the _whole_ then clause.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/net/ldpaa_eth/ldpaa_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c index 75b2b6b..4e61700 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.c +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c @@ -420,13 +420,14 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd) goto err_dpmac_setup;
#ifdef CONFIG_PHYLIB
- if (priv->phydev)
- if (priv->phydev) { err = phy_startup(priv->phydev); if (err) { printf("%s: Could not initialize\n", priv->phydev->dev->name); goto err_dpamc_bind; }
- }
#else priv->phydev = (struct phy_device *)malloc(sizeof(struct phy_device)); memset(priv->phydev, 0, sizeof(struct phy_device));
This is being addressed by http://patchwork.ozlabs.org/patch/690814/. Currently in my test queue.
York

The rtl8169_intr_mask variable isn't used anywhere in the code, so just remove it to avoid a GCC 6.2 compiler warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/net/rtl8169.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index a3f4423..5297e30 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -339,9 +339,6 @@ struct rtl8169_private {
static struct rtl8169_private *tpc;
-static const u16 rtl8169_intr_mask = - SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | - TxOK | RxErr | RxOK; static const unsigned int rtl8169_rx_config = (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);

On Tue, Nov 15, 2016 at 6:50 PM, Andre Przywara andre.przywara@arm.com wrote:
The rtl8169_intr_mask variable isn't used anywhere in the code, so just remove it to avoid a GCC 6.2 compiler warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Wed, Nov 16, 2016 at 12:50:09AM +0000, Andre Przywara wrote:
The rtl8169_intr_mask variable isn't used anywhere in the code, so just remove it to avoid a GCC 6.2 compiler warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

Obviously the mask for the rx and tx select field cannot be right, as it would overlap in one and exceed the 32-bit register in the other case. From looking at the neighbouring bits it looks like the mask should be really 4 bits wide instead of 8.
Pointed out by a GCC 6.2 (default) warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/phy/marvell/comphy_a3700.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/marvell/comphy_a3700.h b/drivers/phy/marvell/comphy_a3700.h index eb2ed7b..dd60b88 100644 --- a/drivers/phy/marvell/comphy_a3700.h +++ b/drivers/phy/marvell/comphy_a3700.h @@ -33,9 +33,9 @@ #define rb_pin_pu_tx BIT(18) #define rb_pin_tx_idle BIT(19) #define rf_gen_rx_sel_shift 22 -#define rf_gen_rx_select (0xFF << rf_gen_rx_sel_shift) +#define rf_gen_rx_select (0x0F << rf_gen_rx_sel_shift) #define rf_gen_tx_sel_shift 26 -#define rf_gen_tx_select (0xFF << rf_gen_tx_sel_shift) +#define rf_gen_tx_select (0x0F << rf_gen_tx_sel_shift) #define rb_phy_rx_init BIT(30)
#define COMPHY_PHY_STAT1_ADDR(lane) MVEBU_REG(0x018318 + (lane) * 0x28)

(Adding a few Marvell people to Cc)
On 16.11.2016 01:50, Andre Przywara wrote:
Obviously the mask for the rx and tx select field cannot be right, as it would overlap in one and exceed the 32-bit register in the other case. From looking at the neighbouring bits it looks like the mask should be really 4 bits wide instead of 8.
Pointed out by a GCC 6.2 (default) warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/phy/marvell/comphy_a3700.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/marvell/comphy_a3700.h b/drivers/phy/marvell/comphy_a3700.h index eb2ed7b..dd60b88 100644 --- a/drivers/phy/marvell/comphy_a3700.h +++ b/drivers/phy/marvell/comphy_a3700.h @@ -33,9 +33,9 @@ #define rb_pin_pu_tx BIT(18) #define rb_pin_tx_idle BIT(19) #define rf_gen_rx_sel_shift 22 -#define rf_gen_rx_select (0xFF << rf_gen_rx_sel_shift) +#define rf_gen_rx_select (0x0F << rf_gen_rx_sel_shift) #define rf_gen_tx_sel_shift 26 -#define rf_gen_tx_select (0xFF << rf_gen_tx_sel_shift) +#define rf_gen_tx_select (0x0F << rf_gen_tx_sel_shift) #define rb_phy_rx_init BIT(30)
#define COMPHY_PHY_STAT1_ADDR(lane) MVEBU_REG(0x018318 + (lane) * 0x28)
Looks good to me, so:
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan

Agree, both fields are 4 bits wide.
Kosta
-----Original Message----- From: Stefan Roese [mailto:sr@denx.de] Sent: Wednesday, November 16, 2016 13:32 To: Andre Przywara Cc: u-boot@lists.denx.de; Nadav Haklai; Kostya Porotchkin; Hanna Hawa Subject: Re: [PATCH 06/12] marvell: comphy_a3700: fix bitmask
(Adding a few Marvell people to Cc)
On 16.11.2016 01:50, Andre Przywara wrote:
Obviously the mask for the rx and tx select field cannot be right, as it would overlap in one and exceed the 32-bit register in the other case. From looking at the neighbouring bits it looks like the mask should be really 4 bits wide instead of 8.
Pointed out by a GCC 6.2 (default) warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/phy/marvell/comphy_a3700.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/marvell/comphy_a3700.h b/drivers/phy/marvell/comphy_a3700.h index eb2ed7b..dd60b88 100644 --- a/drivers/phy/marvell/comphy_a3700.h +++ b/drivers/phy/marvell/comphy_a3700.h @@ -33,9 +33,9 @@ #define rb_pin_pu_tx BIT(18) #define rb_pin_tx_idle BIT(19) #define rf_gen_rx_sel_shift 22 -#define rf_gen_rx_select (0xFF << rf_gen_rx_sel_shift) +#define rf_gen_rx_select (0x0F << rf_gen_rx_sel_shift) #define rf_gen_tx_sel_shift 26 -#define rf_gen_tx_select (0xFF << rf_gen_tx_sel_shift) +#define rf_gen_tx_select (0x0F << rf_gen_tx_sel_shift) #define rb_phy_rx_init BIT(30)
#define COMPHY_PHY_STAT1_ADDR(lane) MVEBU_REG(0x018318 + (lane) * 0x28)
Looks good to me, so:
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan

On Wed, Nov 16, 2016 at 12:50:10AM +0000, Andre Przywara wrote:
Obviously the mask for the rx and tx select field cannot be right, as it would overlap in one and exceed the 32-bit register in the other case. From looking at the neighbouring bits it looks like the mask should be really 4 bits wide instead of 8.
Pointed out by a GCC 6.2 (default) warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Stefan Roese sr@denx.de Reviewed-by: Stefan Roese sr@denx.de
Applied to u-boot/master, thanks!

Apparently the indentation is wrong here, fix this to avoid compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/usb/eth/r8152_fw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/eth/r8152_fw.c b/drivers/usb/eth/r8152_fw.c index b6c8228..81c3754 100644 --- a/drivers/usb/eth/r8152_fw.c +++ b/drivers/usb/eth/r8152_fw.c @@ -871,10 +871,10 @@ void r8153_firmware(struct r8152 *tp) } else if (tp->version == RTL_VER_04) { r8153_pre_ram_code(tp, 0x7001);
- for (i = 0; i < ARRAY_SIZE(r8153_ram_code_bc); i += 2) - ocp_write_word(tp, MCU_TYPE_PLA, - r8153_ram_code_bc[i], - r8153_ram_code_bc[i+1]); + for (i = 0; i < ARRAY_SIZE(r8153_ram_code_bc); i += 2) + ocp_write_word(tp, MCU_TYPE_PLA, + r8153_ram_code_bc[i], + r8153_ram_code_bc[i+1]);
r8153_post_ram_code(tp);

On 11/16/2016 01:50 AM, Andre Przywara wrote:
Apparently the indentation is wrong here, fix this to avoid compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Reviewed-by: Marek Vasut marex@denx.de
drivers/usb/eth/r8152_fw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/eth/r8152_fw.c b/drivers/usb/eth/r8152_fw.c index b6c8228..81c3754 100644 --- a/drivers/usb/eth/r8152_fw.c +++ b/drivers/usb/eth/r8152_fw.c @@ -871,10 +871,10 @@ void r8153_firmware(struct r8152 *tp) } else if (tp->version == RTL_VER_04) { r8153_pre_ram_code(tp, 0x7001);
- for (i = 0; i < ARRAY_SIZE(r8153_ram_code_bc); i += 2)
ocp_write_word(tp, MCU_TYPE_PLA,
r8153_ram_code_bc[i],
r8153_ram_code_bc[i+1]);
for (i = 0; i < ARRAY_SIZE(r8153_ram_code_bc); i += 2)
ocp_write_word(tp, MCU_TYPE_PLA,
r8153_ram_code_bc[i],
r8153_ram_code_bc[i+1]);
r8153_post_ram_code(tp);

On Tue, Nov 15, 2016 at 6:50 PM, Andre Przywara andre.przywara@arm.com wrote:
Apparently the indentation is wrong here, fix this to avoid compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Wed, Nov 16, 2016 at 12:50:11AM +0000, Andre Przywara wrote:
Apparently the indentation is wrong here, fix this to avoid compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Marek Vasut marex@denx.de Acked-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot/master, thanks!

Apparently the indentation is wrong in this case, as the second message should be printed indepdently of the if statement.
Fix this indentation to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- board/davinci/da8xxevm/da850evm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index 50223f4..52f914d 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -164,7 +164,7 @@ int misc_init_r(void) memcmp(env_enetaddr, buff, 6)) printf("Warning: MAC address in SPI flash don't match " "with the MAC address in the environment\n"); - printf("Default using MAC address from environment\n"); + printf("Default using MAC address from environment\n"); } #endif uint8_t enetaddr[8]; @@ -190,7 +190,7 @@ int misc_init_r(void) if (eeprom_mac_read && memcmp(enetaddr, env_enetaddr, 6)) printf("Warning: MAC address in EEPROM don't match " "with the MAC address in the environment\n"); - printf("Default using MAC address from environment\n"); + printf("Default using MAC address from environment\n"); }
#endif

On Wed, Nov 16, 2016 at 12:50:12AM +0000, Andre Przywara wrote:
Apparently the indentation is wrong in this case, as the second message should be printed indepdently of the if statement.
Fix this indentation to avoid both compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Applied to u-boot/master, thanks!

The error checking makes only sense if the previous line has been executed, so add block braces around the _whole_ then clause.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/net/phy/micrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 9ea3105..afcd1a6 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -300,10 +300,11 @@ static int ksz9021_of_config(struct phy_device *phydev) }; int i, ret = 0;
- for (i = 0; i < ARRAY_SIZE(ofcfg); i++) + for (i = 0; i < ARRAY_SIZE(ofcfg); i++) { ret = ksz90x1_of_config_group(phydev, &(ofcfg[i])); if (ret) return ret; + }
return 0; }

On 11/16/2016 01:50 AM, Andre Przywara wrote:
The error checking makes only sense if the previous line has been executed, so add block braces around the _whole_ then clause.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Already fixed
https://patchwork.ozlabs.org/patch/694537/
drivers/net/phy/micrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 9ea3105..afcd1a6 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -300,10 +300,11 @@ static int ksz9021_of_config(struct phy_device *phydev) }; int i, ret = 0;
- for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
for (i = 0; i < ARRAY_SIZE(ofcfg); i++) { ret = ksz90x1_of_config_group(phydev, &(ofcfg[i])); if (ret) return ret;
}
return 0;
}

The final line with the linefeeds should obviously only printed once (what the code actually does), but the indentation suggests otherwise.
Fix the indentation to avoid compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- cmd/tpm_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c index 65332d1..576e4fb 100644 --- a/cmd/tpm_test.c +++ b/cmd/tpm_test.c @@ -539,8 +539,8 @@ static int do_tpmtest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
for (i = 0; i < argc; i++) printf(" %s", argv[i]); - printf("\n------\n"); - } while (0); + printf("\n------\n"); + } while (0); argc--; argv++; c = find_cmd_tbl(argv[0], cmd_cros_tpm_sub,

On 15 November 2016 at 17:50, Andre Przywara andre.przywara@arm.com wrote:
The final line with the linefeeds should obviously only printed once (what the code actually does), but the indentation suggests otherwise.
Fix the indentation to avoid compiler warnings and puzzled readers.
Pointed out by GCC 6.2's -Wmisleading-indentation warning.
Signed-off-by: Andre Przywara andre.przywara@arm.com
cmd/tpm_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

It seems pretty odd that the minimum supported SDHCI frequency is the maximum frequency shifted _left_ by 9 bits. Shifting it right by that amount seems to make much more sense.
Pointed out by GCC 6.2 as the value needs more than 32 bits.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- include/configs/xilinx_zynqmp_ep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/xilinx_zynqmp_ep.h b/include/configs/xilinx_zynqmp_ep.h index 8e4b960..d0ce768 100644 --- a/include/configs/xilinx_zynqmp_ep.h +++ b/include/configs/xilinx_zynqmp_ep.h @@ -14,7 +14,7 @@ #define __CONFIG_ZYNQMP_EP_H
#define CONFIG_ZYNQ_SDHCI_MAX_FREQ 52000000 -#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ << 9) +#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ >> 9) #define CONFIG_ZYNQ_EEPROM #define CONFIG_SATA_CEVA #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \

Hi,
On 16.11.2016 01:50, Andre Przywara wrote:
It seems pretty odd that the minimum supported SDHCI frequency is the maximum frequency shifted _left_ by 9 bits. Shifting it right by that amount seems to make much more sense.
Pointed out by GCC 6.2 as the value needs more than 32 bits.
Signed-off-by: Andre Przywara andre.przywara@arm.com
include/configs/xilinx_zynqmp_ep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/xilinx_zynqmp_ep.h b/include/configs/xilinx_zynqmp_ep.h index 8e4b960..d0ce768 100644 --- a/include/configs/xilinx_zynqmp_ep.h +++ b/include/configs/xilinx_zynqmp_ep.h @@ -14,7 +14,7 @@ #define __CONFIG_ZYNQMP_EP_H
#define CONFIG_ZYNQ_SDHCI_MAX_FREQ 52000000 -#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ << 9) +#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ >> 9) #define CONFIG_ZYNQ_EEPROM #define CONFIG_SATA_CEVA #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \
thanks for the patch. We have fixed that in our internal repo but didn't send this out yet.
Here is the link https://github.com/Xilinx/u-boot-xlnx/commit/299ceaf77ee6d5a555ecb5f129bd924...
Definitely it is good patch and will apply.
Thanks, Michal

On 16.11.2016 07:34, Michal Simek wrote:
Hi,
On 16.11.2016 01:50, Andre Przywara wrote:
It seems pretty odd that the minimum supported SDHCI frequency is the maximum frequency shifted _left_ by 9 bits. Shifting it right by that amount seems to make much more sense.
Pointed out by GCC 6.2 as the value needs more than 32 bits.
Signed-off-by: Andre Przywara andre.przywara@arm.com
include/configs/xilinx_zynqmp_ep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/xilinx_zynqmp_ep.h b/include/configs/xilinx_zynqmp_ep.h index 8e4b960..d0ce768 100644 --- a/include/configs/xilinx_zynqmp_ep.h +++ b/include/configs/xilinx_zynqmp_ep.h @@ -14,7 +14,7 @@ #define __CONFIG_ZYNQMP_EP_H
#define CONFIG_ZYNQ_SDHCI_MAX_FREQ 52000000 -#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ << 9) +#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ >> 9) #define CONFIG_ZYNQ_EEPROM #define CONFIG_SATA_CEVA #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \
thanks for the patch. We have fixed that in our internal repo but didn't send this out yet.
Here is the link https://github.com/Xilinx/u-boot-xlnx/commit/299ceaf77ee6d5a555ecb5f129bd924...
Definitely it is good patch and will apply.
ok - it is already the part of my pull request I sent yesterday http://lists.denx.de/pipermail/u-boot/2016-November/272771.html
Thanks, Michal

On 16/11/16 06:37, Michal Simek wrote:
Hi Michal,
On 16.11.2016 07:34, Michal Simek wrote:
Hi,
On 16.11.2016 01:50, Andre Przywara wrote:
It seems pretty odd that the minimum supported SDHCI frequency is the maximum frequency shifted _left_ by 9 bits. Shifting it right by that amount seems to make much more sense.
Pointed out by GCC 6.2 as the value needs more than 32 bits.
Signed-off-by: Andre Przywara andre.przywara@arm.com
include/configs/xilinx_zynqmp_ep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/xilinx_zynqmp_ep.h b/include/configs/xilinx_zynqmp_ep.h index 8e4b960..d0ce768 100644 --- a/include/configs/xilinx_zynqmp_ep.h +++ b/include/configs/xilinx_zynqmp_ep.h @@ -14,7 +14,7 @@ #define __CONFIG_ZYNQMP_EP_H
#define CONFIG_ZYNQ_SDHCI_MAX_FREQ 52000000 -#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ << 9) +#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ >> 9) #define CONFIG_ZYNQ_EEPROM #define CONFIG_SATA_CEVA #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \
thanks for the patch. We have fixed that in our internal repo but didn't send this out yet.
Here is the link https://github.com/Xilinx/u-boot-xlnx/commit/299ceaf77ee6d5a555ecb5f129bd924...
Definitely it is good patch and will apply.
ok - it is already the part of my pull request I sent yesterday http://lists.denx.de/pipermail/u-boot/2016-November/272771.html
Even better! Out of curiosity: How did you spot this? Was is actually causing problems or was it GCC 6.x as well?
Anyway glad to see it fixed already.
Cheers, Andre.

On 16.11.2016 09:14, André Przywara wrote:
On 16/11/16 06:37, Michal Simek wrote:
Hi Michal,
On 16.11.2016 07:34, Michal Simek wrote:
Hi,
On 16.11.2016 01:50, Andre Przywara wrote:
It seems pretty odd that the minimum supported SDHCI frequency is the maximum frequency shifted _left_ by 9 bits. Shifting it right by that amount seems to make much more sense.
Pointed out by GCC 6.2 as the value needs more than 32 bits.
Signed-off-by: Andre Przywara andre.przywara@arm.com
include/configs/xilinx_zynqmp_ep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/xilinx_zynqmp_ep.h b/include/configs/xilinx_zynqmp_ep.h index 8e4b960..d0ce768 100644 --- a/include/configs/xilinx_zynqmp_ep.h +++ b/include/configs/xilinx_zynqmp_ep.h @@ -14,7 +14,7 @@ #define __CONFIG_ZYNQMP_EP_H
#define CONFIG_ZYNQ_SDHCI_MAX_FREQ 52000000 -#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ << 9) +#define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ >> 9) #define CONFIG_ZYNQ_EEPROM #define CONFIG_SATA_CEVA #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \
thanks for the patch. We have fixed that in our internal repo but didn't send this out yet.
Here is the link https://github.com/Xilinx/u-boot-xlnx/commit/299ceaf77ee6d5a555ecb5f129bd924...
Definitely it is good patch and will apply.
ok - it is already the part of my pull request I sent yesterday http://lists.denx.de/pipermail/u-boot/2016-November/272771.html
Even better! Out of curiosity: How did you spot this? Was is actually causing problems or was it GCC 6.x as well?
Anyway glad to see it fixed already.
Yes, it was causing the problem on emulation platform which hasn't been detected by testing.
Thanks, Michal

The shortname variable isn't referenced anywhere in the code, so just remove it.
Pointed out by a GCC 6.2 default warning option.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/usb/gadget/ether.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 497b981..a210d33 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -76,7 +76,6 @@ unsigned packet_received, packet_sent; /* Based on linux 2.6.27 version */ #define DRIVER_VERSION "May Day 2005"
-static const char shortname[] = "ether"; static const char driver_desc[] = DRIVER_DESC;
#define RX_EXTRA 20 /* guard against rx overflows */

On 11/16/2016 01:50 AM, Andre Przywara wrote:
The shortname variable isn't referenced anywhere in the code, so just remove it.
Pointed out by a GCC 6.2 default warning option.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/usb/gadget/ether.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 497b981..a210d33 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -76,7 +76,6 @@ unsigned packet_received, packet_sent; /* Based on linux 2.6.27 version */ #define DRIVER_VERSION "May Day 2005"
-static const char shortname[] = "ether"; static const char driver_desc[] = DRIVER_DESC;
#define RX_EXTRA 20 /* guard against rx overflows */
Reviewed-by: Marek Vasut marex@denx.de

Hi Andre,
The shortname variable isn't referenced anywhere in the code, so just remove it.
Pointed out by a GCC 6.2 default warning option.
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/usb/gadget/ether.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 497b981..a210d33 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -76,7 +76,6 @@ unsigned packet_received, packet_sent; /* Based on linux 2.6.27 version */ #define DRIVER_VERSION "May Day 2005"
-static const char shortname[] = "ether"; static const char driver_desc[] = DRIVER_DESC;
#define RX_EXTRA 20 /* guard against rx overflows */
Acked-by: Lukasz Majewski l.majewski@samsung.com

On Wed, Nov 16, 2016 at 12:50:16AM +0000, Andre Przywara wrote:
The shortname variable isn't referenced anywhere in the code, so just remove it.
Pointed out by a GCC 6.2 default warning option.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Marek Vasut marex@denx.de Acked-by: Lukasz Majewski l.majewski@samsung.com
Applied to u-boot/master, thanks!

On Wed, Nov 16, 2016 at 12:50:16AM +0000, Andre Przywara wrote:
The shortname variable isn't referenced anywhere in the code, so just remove it.
Pointed out by a GCC 6.2 default warning option.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Marek Vasut marex@denx.de Acked-by: Lukasz Majewski l.majewski@samsung.com
Applied to u-boot/master, thanks!
participants (11)
-
Andre Przywara
-
André Przywara
-
Joe Hershberger
-
Kostya Porotchkin
-
Lukasz Majewski
-
Marek Vasut
-
Michal Simek
-
Simon Glass
-
Stefan Roese
-
Tom Rini
-
york sun