[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202105150822.OE5z5WCY-lkp@intel.com>
Date: Sat, 15 May 2021 13:40:00 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org,
Ramuthevar Vadivel Murugan
<vadivel.muruganx.ramuthevar@...ux.intel.com>
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Miquel Raynal <miquel.raynal@...tlin.com>
Subject: drivers/mtd/nand/raw/intel-nand-controller.c:683 ebu_nand_probe()
warn: 'ebu_host->clk' not released on lines: 644.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 25a1298726e97b9d25379986f5d54d9e62ad6e93
commit: 0b1039f016e8a37c779a4aee362cb2100ebb1cfd mtd: rawnand: Add NAND controller support on Intel LGM SoC
config: arm-randconfig-m031-20210515 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.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>
New smatch warnings:
drivers/mtd/nand/raw/intel-nand-controller.c:683 ebu_nand_probe() warn: 'ebu_host->clk' not released on lines: 644.
vim +683 drivers/mtd/nand/raw/intel-nand-controller.c
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 577 static int ebu_nand_probe(struct platform_device *pdev)
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 578 {
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 579 struct device *dev = &pdev->dev;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 580 struct ebu_nand_controller *ebu_host;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 581 struct nand_chip *nand;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 582 struct mtd_info *mtd = NULL;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 583 struct resource *res;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 584 char *resname;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 585 int ret;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 586 u32 cs;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 587
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 588 ebu_host = devm_kzalloc(dev, sizeof(*ebu_host), GFP_KERNEL);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 589 if (!ebu_host)
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 590 return -ENOMEM;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 591
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 592 ebu_host->dev = dev;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 593 nand_controller_init(&ebu_host->controller);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 594
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 595 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ebunand");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 596 ebu_host->ebu = devm_ioremap_resource(&pdev->dev, res);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 597 if (IS_ERR(ebu_host->ebu))
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 598 return PTR_ERR(ebu_host->ebu);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 599
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 600 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hsnand");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 601 ebu_host->hsnand = devm_ioremap_resource(&pdev->dev, res);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 602 if (IS_ERR(ebu_host->hsnand))
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 603 return PTR_ERR(ebu_host->hsnand);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 604
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 605 ret = device_property_read_u32(dev, "reg", &cs);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 606 if (ret) {
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 607 dev_err(dev, "failed to get chip select: %d\n", ret);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 608 return ret;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 609 }
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 610 ebu_host->cs_num = cs;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 611
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 612 resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 613 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 614 ebu_host->cs[cs].chipaddr = devm_ioremap_resource(dev, res);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 615 ebu_host->cs[cs].nand_pa = res->start;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 616 if (IS_ERR(ebu_host->cs[cs].chipaddr))
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 617 return PTR_ERR(ebu_host->cs[cs].chipaddr);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 618
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 619 ebu_host->clk = devm_clk_get(dev, NULL);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 620 if (IS_ERR(ebu_host->clk))
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 621 return dev_err_probe(dev, PTR_ERR(ebu_host->clk),
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 622 "failed to get clock\n");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 623
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 624 ret = clk_prepare_enable(ebu_host->clk);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 625 if (ret) {
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 626 dev_err(dev, "failed to enable clock: %d\n", ret);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 627 return ret;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 628 }
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 629 ebu_host->clk_rate = clk_get_rate(ebu_host->clk);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 630
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 631 ebu_host->dma_tx = dma_request_chan(dev, "tx");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 632 if (IS_ERR(ebu_host->dma_tx))
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 633 return dev_err_probe(dev, PTR_ERR(ebu_host->dma_tx),
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 634 "failed to request DMA tx chan!.\n");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 635
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 636 ebu_host->dma_rx = dma_request_chan(dev, "rx");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 637 if (IS_ERR(ebu_host->dma_rx))
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 638 return dev_err_probe(dev, PTR_ERR(ebu_host->dma_rx),
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 639 "failed to request DMA rx chan!.\n");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 640
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 641 resname = devm_kasprintf(dev, GFP_KERNEL, "addr_sel%d", cs);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 642 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 643 if (!res)
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 644 return -EINVAL;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 645 ebu_host->cs[cs].addr_sel = res->start;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 646 writel(ebu_host->cs[cs].addr_sel | EBU_ADDR_MASK(5) | EBU_ADDR_SEL_REGEN,
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 647 ebu_host->ebu + EBU_ADDR_SEL(cs));
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 648
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 649 nand_set_flash_node(&ebu_host->chip, dev->of_node);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 650 if (!mtd->name) {
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 651 dev_err(ebu_host->dev, "NAND label property is mandatory\n");
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 652 return -EINVAL;
goto to cleanup code?
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 653 }
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 654
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 655 mtd = nand_to_mtd(&ebu_host->chip);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 656 mtd->dev.parent = dev;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 657 ebu_host->dev = dev;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 658
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 659 platform_set_drvdata(pdev, ebu_host);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 660 nand_set_controller_data(&ebu_host->chip, ebu_host);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 661
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 662 nand = &ebu_host->chip;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 663 nand->controller = &ebu_host->controller;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 664 nand->controller->ops = &ebu_nand_controller_ops;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 665
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 666 /* Scan to find existence of the device */
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 667 ret = nand_scan(&ebu_host->chip, 1);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 668 if (ret)
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 669 goto err_cleanup_dma;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 670
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 671 ret = mtd_device_register(mtd, NULL, 0);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 672 if (ret)
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 673 goto err_clean_nand;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 674
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 675 return 0;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 676
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 677 err_clean_nand:
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 678 nand_cleanup(&ebu_host->chip);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 679 err_cleanup_dma:
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 680 ebu_dma_cleanup(ebu_host);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 681 clk_disable_unprepare(ebu_host->clk);
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 682
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 @683 return ret;
0b1039f016e8a3 Ramuthevar Vadivel Murugan 2020-11-10 684 }
---
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