public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR'
@ 2022-02-11  8:04 Dan Carpenter
  2022-02-11  8:30 ` Tudor.Ambarus
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2022-02-11  8:04 UTC (permalink / raw)
  To: kbuild, Tudor Ambarus; +Cc: lkp, kbuild-all, linux-kernel

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR'
  2022-02-11  8:04 [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR' Dan Carpenter
@ 2022-02-11  8:30 ` Tudor.Ambarus
  2022-02-11 13:37   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Tudor.Ambarus @ 2022-02-11  8:30 UTC (permalink / raw)
  To: dan.carpenter, kbuild; +Cc: lkp, kbuild-all, linux-kernel

On 2/11/22 10:04, Dan Carpenter wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> 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@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.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.
> 

Indeed, thanks! This is a personal development branch, I'll fix it inline since
the patch that adds support for this has not been integrated in mainline yet.
I'm not sure if I have to add the Reported-by tags or how to give credit to
a bug spotted on a patch that has not yet landed in mainline. Maybe by adding
a comment in the comments section of the patch "---"?

Cheers,
ta

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR'
  2022-02-11  8:30 ` Tudor.Ambarus
@ 2022-02-11 13:37   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-02-11 13:37 UTC (permalink / raw)
  To: Tudor.Ambarus; +Cc: kbuild, lkp, kbuild-all, linux-kernel

On Fri, Feb 11, 2022 at 08:30:48AM +0000, Tudor.Ambarus@microchip.com wrote:
> On 2/11/22 10:04, Dan Carpenter wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > 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@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.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.
> > 
> 
> Indeed, thanks! This is a personal development branch, I'll fix it inline since
> the patch that adds support for this has not been integrated in mainline yet.
> I'm not sure if I have to add the Reported-by tags or how to give credit to
> a bug spotted on a patch that has not yet landed in mainline. Maybe by adding
> a comment in the comments section of the patch "---"?

This is an automated email from the kbuild-bot.  Feel free to ignore it
when you want to.  I just look it over and hit the forward button.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-11 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-11  8:04 [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR' Dan Carpenter
2022-02-11  8:30 ` Tudor.Ambarus
2022-02-11 13:37   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox