[l1k:bcm2835_spi_clkcache 1/1] drivers/spi/spi-bcm2835.c:1048:1: warning: no previous prototype for 'bcm2835_spi_set_clk'

From: kernel test robot
Date: Mon Sep 13 2021 - 05:58:34 EST


tree: https://github.com/l1k/linux bcm2835_spi_clkcache
head: c26ae7b1acc28bc6d97707230886c6fe9ece7d15
commit: c26ae7b1acc28bc6d97707230886c6fe9ece7d15 [1/1] spi: bcm2835: Avoid unnecessary recalculation of CLK register
config: arm64-randconfig-r022-20210912 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/l1k/linux/commit/c26ae7b1acc28bc6d97707230886c6fe9ece7d15
git remote add l1k https://github.com/l1k/linux
git fetch --no-tags l1k bcm2835_spi_clkcache
git checkout c26ae7b1acc28bc6d97707230886c6fe9ece7d15
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/spi/spi-bcm2835.c:1048:1: error: return type defaults to 'int' [-Werror=return-type]
1048 | bcm2835_spi_set_clk(struct bcm2835_spi *bs, struct spi_transfer *tfr)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-bcm2835.c:1048:1: warning: no previous prototype for 'bcm2835_spi_set_clk' [-Wmissing-prototypes]
drivers/spi/spi-bcm2835.c: In function 'bcm2835_spi_set_clk':
drivers/spi/spi-bcm2835.c:1070:1: error: control reaches end of non-void function [-Werror=return-type]
1070 | }
| ^
cc1: some warnings being treated as errors


vim +/bcm2835_spi_set_clk +1048 drivers/spi/spi-bcm2835.c

1047
> 1048 bcm2835_spi_set_clk(struct bcm2835_spi *bs, struct spi_transfer *tfr)
1049 {
1050 unsigned long spi_hz = bs->speed_hz = tfr->speed_hz;
1051 unsigned long cdiv;
1052
1053 if (spi_hz >= bs->clk_hz / 2) {
1054 cdiv = 2; /* clk_hz/2 is the fastest we can go */
1055 } else if (spi_hz) {
1056 /* CDIV must be a multiple of two */
1057 cdiv = DIV_ROUND_UP(bs->clk_hz, spi_hz);
1058 cdiv += (cdiv % 2);
1059
1060 if (cdiv >= 65536)
1061 cdiv = 0; /* 0 is the slowest we can go */
1062 } else {
1063 cdiv = 0; /* 0 is the slowest we can go */
1064 }
1065
1066 tfr->effective_speed_hz = bs->effective_speed_hz =
1067 cdiv ? (bs->clk_hz / cdiv) : (bs->clk_hz / 65536);
1068
1069 bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
1070 }
1071

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip