All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/remoteproc/mtk_scp.c:570 scp_probe() warn: missing error code 'ret'
@ 2021-07-09 18:17 kernel test robot
  2021-07-10 14:49 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-07-09 18:17 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9221 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alexandre Courbot <acourbot@chromium.org>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org

Hi Alexandre,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f55966571d5eb2876a11e48e798b4592fa1ffbb7
commit: cbd2dca74926c0e4610c40923cc786b732c9e8ef remoteproc: scp: add COMPILE_TEST dependency
date:   10 months ago
:::::: branch date: 23 hours ago
:::::: commit date: 10 months ago
config: openrisc-randconfig-m031-20210709 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.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/remoteproc/mtk_scp.c:570 scp_probe() warn: missing error code 'ret'

vim +/ret +570 drivers/remoteproc/mtk_scp.c

7017996951fde8 Pi-Hsun Shih 2019-11-12  515  
63c13d61eafe46 Erin Lo      2019-11-12  516  static int scp_probe(struct platform_device *pdev)
63c13d61eafe46 Erin Lo      2019-11-12  517  {
63c13d61eafe46 Erin Lo      2019-11-12  518  	struct device *dev = &pdev->dev;
63c13d61eafe46 Erin Lo      2019-11-12  519  	struct device_node *np = dev->of_node;
63c13d61eafe46 Erin Lo      2019-11-12  520  	struct mtk_scp *scp;
63c13d61eafe46 Erin Lo      2019-11-12  521  	struct rproc *rproc;
63c13d61eafe46 Erin Lo      2019-11-12  522  	struct resource *res;
63c13d61eafe46 Erin Lo      2019-11-12  523  	char *fw_name = "scp.img";
63c13d61eafe46 Erin Lo      2019-11-12  524  	int ret, i;
63c13d61eafe46 Erin Lo      2019-11-12  525  
63c13d61eafe46 Erin Lo      2019-11-12  526  	rproc = rproc_alloc(dev,
63c13d61eafe46 Erin Lo      2019-11-12  527  			    np->name,
63c13d61eafe46 Erin Lo      2019-11-12  528  			    &scp_ops,
63c13d61eafe46 Erin Lo      2019-11-12  529  			    fw_name,
63c13d61eafe46 Erin Lo      2019-11-12  530  			    sizeof(*scp));
63c13d61eafe46 Erin Lo      2019-11-12  531  	if (!rproc) {
63c13d61eafe46 Erin Lo      2019-11-12  532  		dev_err(dev, "unable to allocate remoteproc\n");
63c13d61eafe46 Erin Lo      2019-11-12  533  		return -ENOMEM;
63c13d61eafe46 Erin Lo      2019-11-12  534  	}
63c13d61eafe46 Erin Lo      2019-11-12  535  
63c13d61eafe46 Erin Lo      2019-11-12  536  	scp = (struct mtk_scp *)rproc->priv;
63c13d61eafe46 Erin Lo      2019-11-12  537  	scp->rproc = rproc;
63c13d61eafe46 Erin Lo      2019-11-12  538  	scp->dev = dev;
63c13d61eafe46 Erin Lo      2019-11-12  539  	platform_set_drvdata(pdev, scp);
63c13d61eafe46 Erin Lo      2019-11-12  540  
63c13d61eafe46 Erin Lo      2019-11-12  541  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
63c13d61eafe46 Erin Lo      2019-11-12  542  	scp->sram_base = devm_ioremap_resource(dev, res);
63c13d61eafe46 Erin Lo      2019-11-12  543  	if (IS_ERR((__force void *)scp->sram_base)) {
63c13d61eafe46 Erin Lo      2019-11-12  544  		dev_err(dev, "Failed to parse and map sram memory\n");
63c13d61eafe46 Erin Lo      2019-11-12  545  		ret = PTR_ERR((__force void *)scp->sram_base);
63c13d61eafe46 Erin Lo      2019-11-12  546  		goto free_rproc;
63c13d61eafe46 Erin Lo      2019-11-12  547  	}
63c13d61eafe46 Erin Lo      2019-11-12  548  	scp->sram_size = resource_size(res);
63c13d61eafe46 Erin Lo      2019-11-12  549  
63c13d61eafe46 Erin Lo      2019-11-12  550  	mutex_init(&scp->send_lock);
63c13d61eafe46 Erin Lo      2019-11-12  551  	for (i = 0; i < SCP_IPI_MAX; i++)
63c13d61eafe46 Erin Lo      2019-11-12  552  		mutex_init(&scp->ipi_desc[i].lock);
63c13d61eafe46 Erin Lo      2019-11-12  553  
63c13d61eafe46 Erin Lo      2019-11-12  554  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
63c13d61eafe46 Erin Lo      2019-11-12  555  	scp->reg_base = devm_ioremap_resource(dev, res);
63c13d61eafe46 Erin Lo      2019-11-12  556  	if (IS_ERR((__force void *)scp->reg_base)) {
63c13d61eafe46 Erin Lo      2019-11-12  557  		dev_err(dev, "Failed to parse and map cfg memory\n");
63c13d61eafe46 Erin Lo      2019-11-12  558  		ret = PTR_ERR((__force void *)scp->reg_base);
63c13d61eafe46 Erin Lo      2019-11-12  559  		goto destroy_mutex;
63c13d61eafe46 Erin Lo      2019-11-12  560  	}
63c13d61eafe46 Erin Lo      2019-11-12  561  
63c13d61eafe46 Erin Lo      2019-11-12  562  	ret = scp_map_memory_region(scp);
63c13d61eafe46 Erin Lo      2019-11-12  563  	if (ret)
63c13d61eafe46 Erin Lo      2019-11-12  564  		goto destroy_mutex;
63c13d61eafe46 Erin Lo      2019-11-12  565  
63c13d61eafe46 Erin Lo      2019-11-12  566  	scp->clk = devm_clk_get(dev, "main");
63c13d61eafe46 Erin Lo      2019-11-12  567  	if (IS_ERR(scp->clk)) {
63c13d61eafe46 Erin Lo      2019-11-12  568  		dev_err(dev, "Failed to get clock\n");
63c13d61eafe46 Erin Lo      2019-11-12  569  		ret = PTR_ERR(scp->clk);
63c13d61eafe46 Erin Lo      2019-11-12 @570  		goto release_dev_mem;
63c13d61eafe46 Erin Lo      2019-11-12  571  	}
63c13d61eafe46 Erin Lo      2019-11-12  572  
63c13d61eafe46 Erin Lo      2019-11-12  573  	ret = clk_prepare_enable(scp->clk);
63c13d61eafe46 Erin Lo      2019-11-12  574  	if (ret) {
63c13d61eafe46 Erin Lo      2019-11-12  575  		dev_err(dev, "failed to enable clocks\n");
63c13d61eafe46 Erin Lo      2019-11-12  576  		goto release_dev_mem;
63c13d61eafe46 Erin Lo      2019-11-12  577  	}
63c13d61eafe46 Erin Lo      2019-11-12  578  
63c13d61eafe46 Erin Lo      2019-11-12  579  	ret = scp_ipi_init(scp);
63c13d61eafe46 Erin Lo      2019-11-12  580  	clk_disable_unprepare(scp->clk);
63c13d61eafe46 Erin Lo      2019-11-12  581  	if (ret) {
63c13d61eafe46 Erin Lo      2019-11-12  582  		dev_err(dev, "Failed to init ipi\n");
63c13d61eafe46 Erin Lo      2019-11-12  583  		goto release_dev_mem;
63c13d61eafe46 Erin Lo      2019-11-12  584  	}
63c13d61eafe46 Erin Lo      2019-11-12  585  
63c13d61eafe46 Erin Lo      2019-11-12  586  	/* register SCP initialization IPI */
63c13d61eafe46 Erin Lo      2019-11-12  587  	ret = scp_ipi_register(scp, SCP_IPI_INIT, scp_init_ipi_handler, scp);
63c13d61eafe46 Erin Lo      2019-11-12  588  	if (ret) {
63c13d61eafe46 Erin Lo      2019-11-12  589  		dev_err(dev, "Failed to register IPI_SCP_INIT\n");
63c13d61eafe46 Erin Lo      2019-11-12  590  		goto release_dev_mem;
63c13d61eafe46 Erin Lo      2019-11-12  591  	}
63c13d61eafe46 Erin Lo      2019-11-12  592  
63c13d61eafe46 Erin Lo      2019-11-12  593  	init_waitqueue_head(&scp->run.wq);
63c13d61eafe46 Erin Lo      2019-11-12  594  	init_waitqueue_head(&scp->ack_wq);
63c13d61eafe46 Erin Lo      2019-11-12  595  
7017996951fde8 Pi-Hsun Shih 2019-11-12  596  	scp_add_rpmsg_subdev(scp);
7017996951fde8 Pi-Hsun Shih 2019-11-12  597  
63c13d61eafe46 Erin Lo      2019-11-12  598  	ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), NULL,
63c13d61eafe46 Erin Lo      2019-11-12  599  					scp_irq_handler, IRQF_ONESHOT,
63c13d61eafe46 Erin Lo      2019-11-12  600  					pdev->name, scp);
63c13d61eafe46 Erin Lo      2019-11-12  601  
63c13d61eafe46 Erin Lo      2019-11-12  602  	if (ret) {
63c13d61eafe46 Erin Lo      2019-11-12  603  		dev_err(dev, "failed to request irq\n");
7017996951fde8 Pi-Hsun Shih 2019-11-12  604  		goto remove_subdev;
63c13d61eafe46 Erin Lo      2019-11-12  605  	}
63c13d61eafe46 Erin Lo      2019-11-12  606  
63c13d61eafe46 Erin Lo      2019-11-12  607  	ret = rproc_add(rproc);
63c13d61eafe46 Erin Lo      2019-11-12  608  	if (ret)
7017996951fde8 Pi-Hsun Shih 2019-11-12  609  		goto remove_subdev;
63c13d61eafe46 Erin Lo      2019-11-12  610  
7017996951fde8 Pi-Hsun Shih 2019-11-12  611  	return 0;
63c13d61eafe46 Erin Lo      2019-11-12  612  
7017996951fde8 Pi-Hsun Shih 2019-11-12  613  remove_subdev:
7017996951fde8 Pi-Hsun Shih 2019-11-12  614  	scp_remove_rpmsg_subdev(scp);
63c13d61eafe46 Erin Lo      2019-11-12  615  	scp_ipi_unregister(scp, SCP_IPI_INIT);
63c13d61eafe46 Erin Lo      2019-11-12  616  release_dev_mem:
63c13d61eafe46 Erin Lo      2019-11-12  617  	scp_unmap_memory_region(scp);
63c13d61eafe46 Erin Lo      2019-11-12  618  destroy_mutex:
63c13d61eafe46 Erin Lo      2019-11-12  619  	for (i = 0; i < SCP_IPI_MAX; i++)
63c13d61eafe46 Erin Lo      2019-11-12  620  		mutex_destroy(&scp->ipi_desc[i].lock);
63c13d61eafe46 Erin Lo      2019-11-12  621  	mutex_destroy(&scp->send_lock);
63c13d61eafe46 Erin Lo      2019-11-12  622  free_rproc:
63c13d61eafe46 Erin Lo      2019-11-12  623  	rproc_free(rproc);
63c13d61eafe46 Erin Lo      2019-11-12  624  
63c13d61eafe46 Erin Lo      2019-11-12  625  	return ret;
63c13d61eafe46 Erin Lo      2019-11-12  626  }
63c13d61eafe46 Erin Lo      2019-11-12  627  

:::::: The code at line 570 was first introduced by commit
:::::: 63c13d61eafe4606f1c16c54da40c4eee78e9edf remoteproc/mediatek: add SCP support for mt8183

:::::: TO: Erin Lo <erin.lo@mediatek.com>
:::::: CC: Bjorn Andersson <bjorn.andersson@linaro.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29167 bytes --]

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

* Re: drivers/remoteproc/mtk_scp.c:570 scp_probe() warn: missing error code 'ret'
  2021-07-09 18:17 drivers/remoteproc/mtk_scp.c:570 scp_probe() warn: missing error code 'ret' kernel test robot
@ 2021-07-10 14:49 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-07-10 14:49 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

On Sat, Jul 10, 2021 at 02:17:54AM +0800, kernel test robot wrote:
> CC: kbuild-all(a)lists.01.org
> CC: linux-kernel(a)vger.kernel.org
> TO: Alexandre Courbot <acourbot@chromium.org>
> CC: Mauro Carvalho Chehab <mchehab@kernel.org>
> CC: linux-media(a)vger.kernel.org
> 
> Hi Alexandre,
> 
> First bad commit (maybe != root cause):
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   f55966571d5eb2876a11e48e798b4592fa1ffbb7
> commit: cbd2dca74926c0e4610c40923cc786b732c9e8ef remoteproc: scp: add COMPILE_TEST dependency
> date:   10 months ago
> :::::: branch date: 23 hours ago
> :::::: commit date: 10 months ago
> config: openrisc-randconfig-m031-20210709 (attached as .config)

Smatch seesm to completely fall apart on some of these arches.  I don't
know why...  :/  I think it's because Smatch thinks the pointers are
signed or something and that messes up parsing of PTR_ERR()?

regards,
dan carpenter

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

end of thread, other threads:[~2021-07-10 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 18:17 drivers/remoteproc/mtk_scp.c:570 scp_probe() warn: missing error code 'ret' kernel test robot
2021-07-10 14:49 ` Dan Carpenter

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.