[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202202110830.1OGwXRWt-lkp@intel.com>
Date: Fri, 11 Feb 2022 11:04:51 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, Tudor Ambarus <tudor.ambarus@...rochip.com>
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202
atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR'
tree: https://github.com/ambarus/linux-0day spi-nor/next
head: 038b3fa2d89f1a00fdb8767704cdb799a0fe746b
commit: ff51c966a3c5144ae964797349747e680ee47c3a [1/15] spi: atmel-quadspi: Add support for sama7g5 QSPI
config: openrisc-randconfig-m031-20220210 (https://download.01.org/0day-ci/archive/20220211/202202110830.1OGwXRWt-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
smatch warnings:
drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +1202 drivers/spi/atmel-quadspi.c
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1194 static int atmel_qspi_dma_init(struct spi_controller *ctrl)
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1195 {
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1196 struct atmel_qspi *aq = spi_controller_get_devdata(ctrl);
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1197 int ret;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1198
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1199 aq->rx_chan = dma_request_chan(&aq->pdev->dev, "rx");
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1200 if (IS_ERR(aq->rx_chan)) {
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1201 aq->rx_chan = NULL;
Need to preserve the error code before setting this to NULL
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 @1202 return dev_err_probe(&aq->pdev->dev, PTR_ERR(aq->rx_chan),
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1203 "RX DMA channel is not available\n");
This will return success.
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1204 }
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1205
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1206 aq->tx_chan = dma_request_chan(&aq->pdev->dev, "tx");
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1207 if (IS_ERR(aq->tx_chan)) {
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1208 ret = dev_err_probe(&aq->pdev->dev, PTR_ERR(aq->tx_chan),
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1209 "TX DMA channel is not available\n");
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1210 goto release_rx_chan;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1211 }
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1212
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1213 ctrl->dma_rx = aq->rx_chan;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1214 ctrl->dma_tx = aq->tx_chan;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1215 init_completion(&aq->dma_completion);
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1216
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1217 dev_info(&aq->pdev->dev, "Using %s (tx) and %s (rx) for DMA transfers\n",
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1218 dma_chan_name(aq->tx_chan), dma_chan_name(aq->rx_chan));
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1219
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1220 return 0;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1221
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1222 release_rx_chan:
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1223 dma_release_channel(aq->rx_chan);
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1224 aq->rx_chan = NULL;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1225 aq->tx_chan = NULL;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1226 return ret;
ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus 2020-10-19 1227 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists