lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/tty/serial/uartlite.c:810 ulite_probe() warn: 'pdata->clk' not released on lines: 802.
Hi Shubhrajyoti Datta,

[ The patch a revert so it blames the wrong person (Greg). But it seems
buggy. See below. -dan ]

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fc4f28bb3daf3265d6bc5f73b497306985bb23ab
commit: f4c47547b40a212f4eb017297f9d232ac09f7aaf Revert "serial-uartlite: Move the uart register"
config: x86_64-randconfig-m001-20200916 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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>

New smatch warnings:
drivers/tty/serial/uartlite.c:810 ulite_probe() warn: 'pdata->clk' not released on lines: 802.

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f4c47547b40a212f4eb017297f9d232ac09f7aaf
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f4c47547b40a212f4eb017297f9d232ac09f7aaf
vim +810 drivers/tty/serial/uartlite.c

9671f09921d93e drivers/tty/serial/uartlite.c Bill Pemberton 2012-11-19 753 static int ulite_probe(struct platform_device *pdev)
238b8721a554a3 drivers/serial/uartlite.c Peter Korsgaard 2006-12-06 754 {
5c90c07b98c021 drivers/tty/serial/uartlite.c Michal Simek 2015-04-13 755 struct resource *res;
da7bf20e775804 drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 756 struct uartlite_data *pdata;
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 757 int irq, ret;
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 758 int id = pdev->id;
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 759 #ifdef CONFIG_OF
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 760 const __be32 *prop;
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 761
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 762 prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 763 if (prop)
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 764 id = be32_to_cpup(prop);
e5263a517688b8 drivers/tty/serial/uartlite.c Grant Likely 2011-02-22 765 #endif
da7bf20e775804 drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 766 pdata = devm_kzalloc(&pdev->dev, sizeof(struct uartlite_data),
da7bf20e775804 drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 767 GFP_KERNEL);
da7bf20e775804 drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 768 if (!pdata)
da7bf20e775804 drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 769 return -ENOMEM;
238b8721a554a3 drivers/serial/uartlite.c Peter Korsgaard 2006-12-06 770
8fa7b6100693e0 drivers/serial/uartlite.c Grant Likely 2007-10-02 771 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
8fa7b6100693e0 drivers/serial/uartlite.c Grant Likely 2007-10-02 772 if (!res)
8fa7b6100693e0 drivers/serial/uartlite.c Grant Likely 2007-10-02 773 return -ENODEV;
238b8721a554a3 drivers/serial/uartlite.c Peter Korsgaard 2006-12-06 774
5c90c07b98c021 drivers/tty/serial/uartlite.c Michal Simek 2015-04-13 775 irq = platform_get_irq(pdev, 0);
5c90c07b98c021 drivers/tty/serial/uartlite.c Michal Simek 2015-04-13 776 if (irq <= 0)
5c90c07b98c021 drivers/tty/serial/uartlite.c Michal Simek 2015-04-13 777 return -ENXIO;
238b8721a554a3 drivers/serial/uartlite.c Peter Korsgaard 2006-12-06 778
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 779 pdata->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 780 if (IS_ERR(pdata->clk)) {
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 781 if (PTR_ERR(pdata->clk) != -ENOENT)
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 782 return PTR_ERR(pdata->clk);
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 783
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 784 /*
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 785 * Clock framework support is optional, continue on
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 786 * anyways if we don't find a matching clock.
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 787 */
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 788 pdata->clk = NULL;
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 789 }
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 790
ea42d7a67a9e2b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-08-06 791 ret = clk_prepare_enable(pdata->clk);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 792 if (ret) {
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 793 dev_err(&pdev->dev, "Failed to prepare clock\n");
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 794 return ret;
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 795 }
14288befeb572b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-07-21 796
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 797 if (!ulite_uart_driver.state) {
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 798 dev_dbg(&pdev->dev, "uartlite: calling uart_register_driver()\n");
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 799 ret = uart_register_driver(&ulite_uart_driver);
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 800 if (ret < 0) {
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 801 dev_err(&pdev->dev, "Failed to register driver\n");
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 802 return ret;
^^^^^^^^^^
clk_disable_unprepare(pdata->clk); on error path?

f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 803 }
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 804 }
f4c47547b40a21 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 805
ea42d7a67a9e2b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-08-06 806 ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata);
ea42d7a67a9e2b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-08-06 807
07e5d4ff125ad0 drivers/tty/serial/uartlite.c Greg Kroah-Hartman 2019-11-14 808 clk_disable(pdata->clk);
^^^^^^^^^^^^^^^^^^^^^^
This disables the clock on the success path and it comes from
commit ea42d7a67a9e ("tty: serial: uartlite: Enable clocks at probe")
We do a second disable in the ->remove() function so it just seems
very wrong.

ea42d7a67a9e2b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-08-06 809
ea42d7a67a9e2b drivers/tty/serial/uartlite.c Shubhrajyoti Datta 2018-08-06 @810 return ret;
8fa7b6100693e0 drivers/serial/uartlite.c Grant Likely 2007-10-02 811 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-09-16 15:29    [W:0.061 / U:4.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site