1. 30 May, 2018 2 commits
    • Arnd Bergmann's avatar
      net: davinci: fix building davinci mdio code without CONFIG_OF · 37c9102f
      Arnd Bergmann authored
      Test-building this driver on targets without CONFIG_OF revealed a build
      failure:
      
      drivers/net/ethernet/ti/davinci_mdio.c: In function 'davinci_mdio_probe':
      drivers/net/ethernet/ti/davinci_mdio.c:380:9: error: implicit declaration of function 'davinci_mdio_probe_dt'; did you mean 'davinci_mdio_probe'? [-Werror=implicit-function-declaration]
      
      This adjusts the #ifdef logic in the driver to make it build in
      all configurations.
      
      Fixes: 2652113f ("net: ethernet: ti: Allow most drivers with COMPILE_TEST")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarSekhar Nori <nsekhar@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      37c9102f
    • Arnd Bergmann's avatar
      net: ethernet: freescale: fix false-positive string overflow warning · 3ded9f2b
      Arnd Bergmann authored
      While compile-testing on arm64 with gcc-8.1, I ran into a build diagnostic:
      
      drivers/net/ethernet/freescale/fec_main.c: In function 'fec_probe':
      drivers/net/ethernet/freescale/fec_main.c:3517:25: error: '%d' directive writing between 1 and 10 bytes into a region of size 5 [-Werror=format-overflow=]
         sprintf(irq_name, "int%d", i);
                               ^~
      drivers/net/ethernet/freescale/fec_main.c:3517:21: note: directive argument in the range [0, 2147483646]
         sprintf(irq_name, "int%d", i);
                           ^~~~~~~
      drivers/net/ethernet/freescale/fec_main.c:3517:3: note: 'sprintf' output between 5 and 14 bytes into a destination of size 8
         sprintf(irq_name, "int%d", i);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      It appears this has never shown on ppc32 or arm32 for an unknown reason, but
      now gcc fails to identify that the 'irq_cnt' loop index has an upper bound
      of 3, and instead uses a bogus range.
      
      To work around the warning, this changes the sprintf to snprintf with the
      correct buffer length.
      
      Fixes: 78cc6e7e ("net: ethernet: freescale: Allow FEC with COMPILE_TEST")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ded9f2b
  2. 29 May, 2018 38 commits