[spi:for-5.2 70/75] drivers/spi/spi-gpio.c:313:1-3: WARNING: PTR_ERR_OR_ZERO can be used

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.2
head:   67dca5e580f1e93a66177389981541cac208c817
commit: 249e2632dcd0509b8f8f296f5aabf4d48dfd6da8 [70/75] spi: gpio: Don't request CS GPIO in DT use-case


coccinelle warnings: (new ones prefixed by >>)

>> drivers/spi/spi-gpio.c:313:1-3: WARNING: PTR_ERR_OR_ZERO can be used

vim +313 drivers/spi/spi-gpio.c

d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  281  
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  282  /*
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  283   * It can be convenient to use this driver with pins that have alternate
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  284   * functions associated with a "native" SPI controller if a driver for that
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  285   * controller is not available, or is missing important functionality.
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  286   *
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  287   * On platforms which can do so, configure MISO with a weak pullup unless
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  288   * there's an external pullup on that signal.  That saves power by avoiding
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  289   * floating signals.  (A weak pulldown would save power too, but many
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  290   * drivers expect to see all-ones data as the no slave "response".)
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  291   */
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  292  static int spi_gpio_request(struct device *dev,
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  293  			    struct spi_gpio *spi_gpio,
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  294  			    u16 *mflags)
d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  295  {
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  296  	spi_gpio->mosi = devm_gpiod_get_optional(dev, "mosi", GPIOD_OUT_LOW);
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  297  	if (IS_ERR(spi_gpio->mosi))
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  298  		return PTR_ERR(spi_gpio->mosi);
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  299  	if (!spi_gpio->mosi)
3c8e1a84 drivers/spi/spi_gpio.c Marek Szyprowski 2010-06-30  300  		/* HW configuration without MOSI pin */
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  301  		*mflags |= SPI_MASTER_NO_TX;
d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  302  
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  303  	spi_gpio->miso = devm_gpiod_get_optional(dev, "miso", GPIOD_IN);
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  304  	if (IS_ERR(spi_gpio->miso))
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  305  		return PTR_ERR(spi_gpio->miso);
abf5feef drivers/spi/spi-gpio.c Linus Walleij    2018-09-10  306  	/*
abf5feef drivers/spi/spi-gpio.c Linus Walleij    2018-09-10  307  	 * No setting SPI_MASTER_NO_RX here - if there is only a MOSI
abf5feef drivers/spi/spi-gpio.c Linus Walleij    2018-09-10  308  	 * pin connected the host can still do RX by changing the
abf5feef drivers/spi/spi-gpio.c Linus Walleij    2018-09-10  309  	 * direction of the line.
abf5feef drivers/spi/spi-gpio.c Linus Walleij    2018-09-10  310  	 */
d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  311  
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  312  	spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
1723c315 drivers/spi/spi-gpio.c Linus Walleij    2018-09-04 @313  	if (IS_ERR(spi_gpio->sck))
1723c315 drivers/spi/spi-gpio.c Linus Walleij    2018-09-04  314  		return PTR_ERR(spi_gpio->sck);
d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  315  
9b00bc7b drivers/spi/spi-gpio.c Linus Walleij    2018-02-12  316  	return 0;
d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  317  }
d29389de drivers/spi/spi_gpio.c David Brownell   2009-01-06  318  

:::::: The code at line 313 was first introduced by commit
:::::: 1723c3155f117ee6e00f28fadf6e9eda4fc85806 spi: gpio: Fix copy-and-paste error

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

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux