[linux-next:pending-fixes 383/622] drivers/spi/spi-bcm2835.c:1264:9: warning: variable 'lflags' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Martin,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git pending-fixes
head:   a2808d2bc1fbfd71e47ffe18f53b4ab14ba1775f
commit: 5e31ba0c0543a04483b53151eb5b7413efece94c [383/622] spi: bcm2835: fix gpio cs level inversion
config: mips-randconfig-r032-20201030 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project fa5a13276764a2657b3571fa3c57b07ee5d2d661)
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
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5e31ba0c0543a04483b53151eb5b7413efece94c
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next pending-fixes
        git checkout 5e31ba0c0543a04483b53151eb5b7413efece94c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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:1264:9: warning: variable 'lflags' is uninitialized when used here [-Wuninitialized]
                                                     lflags,
                                                     ^~~~~~
   drivers/spi/spi-bcm2835.c:1196:2: note: variable 'lflags' is declared here
           enum gpio_lookup_flags lflags;
           ^
   1 warning generated.

vim +/lflags +1264 drivers/spi/spi-bcm2835.c

a30a555d7435a44 Martin Sperl  2015-04-06  1190  
e34ff011c70e5f4 Martin Sperl  2015-03-26  1191  static int bcm2835_spi_setup(struct spi_device *spi)
e34ff011c70e5f4 Martin Sperl  2015-03-26  1192  {
8259bf667a0f9ea Lukas Wunner  2019-09-11  1193  	struct spi_controller *ctlr = spi->controller;
8259bf667a0f9ea Lukas Wunner  2019-09-11  1194  	struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
a30a555d7435a44 Martin Sperl  2015-04-06  1195  	struct gpio_chip *chip;
3bd158c56a56e87 Linus Walleij 2019-08-04  1196  	enum gpio_lookup_flags lflags;
571e31fa60b3697 Lukas Wunner  2019-09-11  1197  	u32 cs;
571e31fa60b3697 Lukas Wunner  2019-09-11  1198  
571e31fa60b3697 Lukas Wunner  2019-09-11  1199  	/*
571e31fa60b3697 Lukas Wunner  2019-09-11  1200  	 * Precalculate SPI slave's CS register value for ->prepare_message():
571e31fa60b3697 Lukas Wunner  2019-09-11  1201  	 * The driver always uses software-controlled GPIO chip select, hence
571e31fa60b3697 Lukas Wunner  2019-09-11  1202  	 * set the hardware-controlled native chip select to an invalid value
571e31fa60b3697 Lukas Wunner  2019-09-11  1203  	 * to prevent it from interfering.
571e31fa60b3697 Lukas Wunner  2019-09-11  1204  	 */
571e31fa60b3697 Lukas Wunner  2019-09-11  1205  	cs = BCM2835_SPI_CS_CS_10 | BCM2835_SPI_CS_CS_01;
571e31fa60b3697 Lukas Wunner  2019-09-11  1206  	if (spi->mode & SPI_CPOL)
571e31fa60b3697 Lukas Wunner  2019-09-11  1207  		cs |= BCM2835_SPI_CS_CPOL;
571e31fa60b3697 Lukas Wunner  2019-09-11  1208  	if (spi->mode & SPI_CPHA)
571e31fa60b3697 Lukas Wunner  2019-09-11  1209  		cs |= BCM2835_SPI_CS_CPHA;
571e31fa60b3697 Lukas Wunner  2019-09-11  1210  	bs->prepare_cs[spi->chip_select] = cs;
3bd158c56a56e87 Linus Walleij 2019-08-04  1211  
8259bf667a0f9ea Lukas Wunner  2019-09-11  1212  	/*
8259bf667a0f9ea Lukas Wunner  2019-09-11  1213  	 * Precalculate SPI slave's CS register value to clear RX FIFO
8259bf667a0f9ea Lukas Wunner  2019-09-11  1214  	 * in case of a TX-only DMA transfer.
8259bf667a0f9ea Lukas Wunner  2019-09-11  1215  	 */
8259bf667a0f9ea Lukas Wunner  2019-09-11  1216  	if (ctlr->dma_rx) {
8259bf667a0f9ea Lukas Wunner  2019-09-11  1217  		bs->clear_rx_cs[spi->chip_select] = cs |
8259bf667a0f9ea Lukas Wunner  2019-09-11  1218  						    BCM2835_SPI_CS_TA |
8259bf667a0f9ea Lukas Wunner  2019-09-11  1219  						    BCM2835_SPI_CS_DMAEN |
8259bf667a0f9ea Lukas Wunner  2019-09-11  1220  						    BCM2835_SPI_CS_CLEAR_RX;
8259bf667a0f9ea Lukas Wunner  2019-09-11  1221  		dma_sync_single_for_device(ctlr->dma_rx->device->dev,
8259bf667a0f9ea Lukas Wunner  2019-09-11  1222  					   bs->clear_rx_addr,
8259bf667a0f9ea Lukas Wunner  2019-09-11  1223  					   sizeof(bs->clear_rx_cs),
8259bf667a0f9ea Lukas Wunner  2019-09-11  1224  					   DMA_TO_DEVICE);
8259bf667a0f9ea Lukas Wunner  2019-09-11  1225  	}
8259bf667a0f9ea Lukas Wunner  2019-09-11  1226  
e34ff011c70e5f4 Martin Sperl  2015-03-26  1227  	/*
e34ff011c70e5f4 Martin Sperl  2015-03-26  1228  	 * sanity checking the native-chipselects
e34ff011c70e5f4 Martin Sperl  2015-03-26  1229  	 */
e34ff011c70e5f4 Martin Sperl  2015-03-26  1230  	if (spi->mode & SPI_NO_CS)
e34ff011c70e5f4 Martin Sperl  2015-03-26  1231  		return 0;
3bd158c56a56e87 Linus Walleij 2019-08-04  1232  	/*
3bd158c56a56e87 Linus Walleij 2019-08-04  1233  	 * The SPI core has successfully requested the CS GPIO line from the
3bd158c56a56e87 Linus Walleij 2019-08-04  1234  	 * device tree, so we are done.
3bd158c56a56e87 Linus Walleij 2019-08-04  1235  	 */
3bd158c56a56e87 Linus Walleij 2019-08-04  1236  	if (spi->cs_gpiod)
e34ff011c70e5f4 Martin Sperl  2015-03-26  1237  		return 0;
a30a555d7435a44 Martin Sperl  2015-04-06  1238  	if (spi->chip_select > 1) {
a30a555d7435a44 Martin Sperl  2015-04-06  1239  		/* error in the case of native CS requested with CS > 1
a30a555d7435a44 Martin Sperl  2015-04-06  1240  		 * officially there is a CS2, but it is not documented
a30a555d7435a44 Martin Sperl  2015-04-06  1241  		 * which GPIO is connected with that...
a30a555d7435a44 Martin Sperl  2015-04-06  1242  		 */
a30a555d7435a44 Martin Sperl  2015-04-06  1243  		dev_err(&spi->dev,
a30a555d7435a44 Martin Sperl  2015-04-06  1244  			"setup: only two native chip-selects are supported\n");
a30a555d7435a44 Martin Sperl  2015-04-06  1245  		return -EINVAL;
a30a555d7435a44 Martin Sperl  2015-04-06  1246  	}
3bd158c56a56e87 Linus Walleij 2019-08-04  1247  
3bd158c56a56e87 Linus Walleij 2019-08-04  1248  	/*
3bd158c56a56e87 Linus Walleij 2019-08-04  1249  	 * Translate native CS to GPIO
3bd158c56a56e87 Linus Walleij 2019-08-04  1250  	 *
3bd158c56a56e87 Linus Walleij 2019-08-04  1251  	 * FIXME: poking around in the gpiolib internals like this is
3bd158c56a56e87 Linus Walleij 2019-08-04  1252  	 * not very good practice. Find a way to locate the real problem
3bd158c56a56e87 Linus Walleij 2019-08-04  1253  	 * and fix it. Why is the GPIO descriptor in spi->cs_gpiod
3bd158c56a56e87 Linus Walleij 2019-08-04  1254  	 * sometimes not assigned correctly? Erroneous device trees?
3bd158c56a56e87 Linus Walleij 2019-08-04  1255  	 */
a30a555d7435a44 Martin Sperl  2015-04-06  1256  
a30a555d7435a44 Martin Sperl  2015-04-06  1257  	/* get the gpio chip for the base */
a30a555d7435a44 Martin Sperl  2015-04-06  1258  	chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
a30a555d7435a44 Martin Sperl  2015-04-06  1259  	if (!chip)
f8043872e79614a Chris Boot    2013-03-11  1260  		return 0;
e34ff011c70e5f4 Martin Sperl  2015-03-26  1261  
3bd158c56a56e87 Linus Walleij 2019-08-04  1262  	spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
3bd158c56a56e87 Linus Walleij 2019-08-04  1263  						  DRV_NAME,
3bd158c56a56e87 Linus Walleij 2019-08-04 @1264  						  lflags,
3bd158c56a56e87 Linus Walleij 2019-08-04  1265  						  GPIOD_OUT_LOW);
3bd158c56a56e87 Linus Walleij 2019-08-04  1266  	if (IS_ERR(spi->cs_gpiod))
3bd158c56a56e87 Linus Walleij 2019-08-04  1267  		return PTR_ERR(spi->cs_gpiod);
a30a555d7435a44 Martin Sperl  2015-04-06  1268  
a30a555d7435a44 Martin Sperl  2015-04-06  1269  	/* and set up the "mode" and level */
3bd158c56a56e87 Linus Walleij 2019-08-04  1270  	dev_info(&spi->dev, "setting up native-CS%i to use GPIO\n",
3bd158c56a56e87 Linus Walleij 2019-08-04  1271  		 spi->chip_select);
a30a555d7435a44 Martin Sperl  2015-04-06  1272  
a30a555d7435a44 Martin Sperl  2015-04-06  1273  	return 0;
f8043872e79614a Chris Boot    2013-03-11  1274  }
f8043872e79614a Chris Boot    2013-03-11  1275  

:::::: The code at line 1264 was first introduced by commit
:::::: 3bd158c56a56e8767e569d7fbc66efbedc478077 spi: bcm2835: Convert to use CS GPIO descriptors

:::::: TO: Linus Walleij <linus.walleij@xxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux