All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Dhruva Gole <d-gole@ti.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Mark Brown <broonie@kernel.org>, Apurva Nandan <a-nandan@ti.com>
Subject: [linux-next:master 1275/4965] drivers/spi/spi-cadence-quadspi.c:1882 cqspi_probe() warn: missing unwind goto?
Date: Thu, 14 Sep 2023 12:07:55 +0300	[thread overview]
Message-ID: <5e21c351-cd08-443e-8509-aecf242a4da9@kadam.mountain> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   e143016b56ecb0fcda5bb6026b0a25fe55274f56
commit: 0578a6dbfe7514db7134501cf93acc21cf13e479 [1275/4965] spi: spi-cadence-quadspi: add runtime pm support
config: x86_64-randconfig-161-20230913 (https://download.01.org/0day-ci/archive/20230914/202309140543.03dMbMM5-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230914/202309140543.03dMbMM5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202309140543.03dMbMM5-lkp@intel.com/

smatch warnings:
drivers/spi/spi-cadence-quadspi.c:1882 cqspi_probe() warn: missing unwind goto?

vim +1882 drivers/spi/spi-cadence-quadspi.c

14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1861  	cqspi_wait_idle(cqspi);
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1862  	cqspi_controller_init(cqspi);
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1863  	cqspi->current_cs = -1;
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1864  	cqspi->sclk = 0;
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1865  
1c75d749b5ebd2 drivers/spi/spi-cadence-quadspi.c                 Yang Yingliang             2023-08-07  1866  	host->num_chipselect = cqspi->num_chipselect;
b436fb7d29bfa4 drivers/spi/spi-cadence-quadspi.c                 Ramuthevar Vadivel Murugan 2020-11-24  1867  
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1868  	ret = cqspi_setup_flash(cqspi);
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1869  	if (ret) {
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1870  		dev_err(dev, "failed to setup flash parameters %d\n", ret);
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1871  		goto probe_setup_failed;
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1872  	}
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1873  
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1874  	if (cqspi->use_direct_mode) {
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1875  		ret = cqspi_request_mmap_dma(cqspi);
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1876  		if (ret == -EPROBE_DEFER)
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1877  			goto probe_setup_failed;
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1878  	}
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1879  
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1880  	ret = devm_pm_runtime_enable(dev);
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1881  	if (ret)
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29 @1882  		return ret;

This needs to clean up before returning.  The error handling in this
function is slightly buggy.  It needs to undo cqspi_request_mmap_dma()
for example using:

	if (cqspi->rx_chan)
		dma_release_channel(cqspi->rx_chan);

I wrote a blog about error handling:
https://staticthinking.wordpress.com/2022/04/28/free-the-last-thing-style/

0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1883  
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1884  	pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT);
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1885  	pm_runtime_use_autosuspend(dev);
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1886  	pm_runtime_get_noresume(dev);
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1887  
1c75d749b5ebd2 drivers/spi/spi-cadence-quadspi.c                 Yang Yingliang             2023-08-07  1888  	ret = spi_register_controller(host);
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1889  	if (ret) {
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1890  		dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret);
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1891  		goto probe_setup_failed;
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1892  	}
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1893  
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1894  	pm_runtime_mark_last_busy(dev);
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1895  	pm_runtime_put_autosuspend(dev);
0578a6dbfe7514 drivers/spi/spi-cadence-quadspi.c                 Dhruva Gole                2023-08-29  1896  
a314f6367787ee drivers/mtd/spi-nor/controllers/cadence-quadspi.c Ramuthevar Vadivel Murugan 2020-06-01  1897  	return 0;
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1898  probe_setup_failed:
329864d35a7f49 drivers/mtd/spi-nor/cadence-quadspi.c             Vignesh R                  2017-10-03  1899  	cqspi_controller_enable(cqspi, 0);
c61088d1f99329 drivers/mtd/spi-nor/controllers/cadence-quadspi.c Vignesh Raghavendra        2020-06-01  1900  probe_reset_failed:
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1901  	clk_disable_unprepare(cqspi->clk);
4892b374c9b797 drivers/mtd/spi-nor/cadence-quadspi.c             Vignesh R                  2017-10-03  1902  probe_clk_failed:
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1903  	return ret;
14062341053690 drivers/mtd/spi-nor/cadence-quadspi.c             Graham Moore               2016-06-04  1904  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


             reply	other threads:[~2023-09-14  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  9:07 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-09-13 21:21 [linux-next:master 1275/4965] drivers/spi/spi-cadence-quadspi.c:1882 cqspi_probe() warn: missing unwind goto? kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e21c351-cd08-443e-8509-aecf242a4da9@kadam.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=a-nandan@ti.com \
    --cc=broonie@kernel.org \
    --cc=d-gole@ti.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.