public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Amit Singh Tomar <amittomer25@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: drivers/tty/serial/owl-uart.c:712 owl_uart_probe() warn: 'owl_port->clk' not released on lines: 698.
Date: Tue, 27 Oct 2020 12:00:42 +0300	[thread overview]
Message-ID: <20201027090024.GO1042@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7cf726a59435301046250c42131554d9ccc566b8
commit: abf42d2f333b21bf8d33b2fbb8a85fa62037ac01 tty: serial: owl: add "much needed" clk_prepare_enable()
config: ia64-randconfig-m031-20201019 (attached as .config)
compiler: ia64-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/tty/serial/owl-uart.c:712 owl_uart_probe() warn: 'owl_port->clk' not released on lines: 698.

vim +712 drivers/tty/serial/owl-uart.c

fc60a8b675bd949 Andreas Färber   2017-07-09  638  static int owl_uart_probe(struct platform_device *pdev)
fc60a8b675bd949 Andreas Färber   2017-07-09  639  {
fc60a8b675bd949 Andreas Färber   2017-07-09  640  	const struct of_device_id *match;
fc60a8b675bd949 Andreas Färber   2017-07-09  641  	const struct owl_uart_info *info = NULL;
fc60a8b675bd949 Andreas Färber   2017-07-09  642  	struct resource *res_mem;
fc60a8b675bd949 Andreas Färber   2017-07-09  643  	struct owl_uart_port *owl_port;
fc60a8b675bd949 Andreas Färber   2017-07-09  644  	int ret, irq;
fc60a8b675bd949 Andreas Färber   2017-07-09  645  
fc60a8b675bd949 Andreas Färber   2017-07-09  646  	if (pdev->dev.of_node) {
fc60a8b675bd949 Andreas Färber   2017-07-09  647  		pdev->id = of_alias_get_id(pdev->dev.of_node, "serial");
fc60a8b675bd949 Andreas Färber   2017-07-09  648  		match = of_match_node(owl_uart_dt_matches, pdev->dev.of_node);
fc60a8b675bd949 Andreas Färber   2017-07-09  649  		if (match)
fc60a8b675bd949 Andreas Färber   2017-07-09  650  			info = match->data;
fc60a8b675bd949 Andreas Färber   2017-07-09  651  	}
fc60a8b675bd949 Andreas Färber   2017-07-09  652  
fc60a8b675bd949 Andreas Färber   2017-07-09  653  	if (pdev->id < 0 || pdev->id >= OWL_UART_PORT_NUM) {
fc60a8b675bd949 Andreas Färber   2017-07-09  654  		dev_err(&pdev->dev, "id %d out of range\n", pdev->id);
fc60a8b675bd949 Andreas Färber   2017-07-09  655  		return -EINVAL;
fc60a8b675bd949 Andreas Färber   2017-07-09  656  	}
fc60a8b675bd949 Andreas Färber   2017-07-09  657  
fc60a8b675bd949 Andreas Färber   2017-07-09  658  	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
fc60a8b675bd949 Andreas Färber   2017-07-09  659  	if (!res_mem) {
fc60a8b675bd949 Andreas Färber   2017-07-09  660  		dev_err(&pdev->dev, "could not get mem\n");
fc60a8b675bd949 Andreas Färber   2017-07-09  661  		return -ENODEV;
fc60a8b675bd949 Andreas Färber   2017-07-09  662  	}
fc60a8b675bd949 Andreas Färber   2017-07-09  663  
fc60a8b675bd949 Andreas Färber   2017-07-09  664  	irq = platform_get_irq(pdev, 0);
1df217868178bde Stephen Boyd     2019-07-30  665  	if (irq < 0)
fc60a8b675bd949 Andreas Färber   2017-07-09  666  		return irq;
fc60a8b675bd949 Andreas Färber   2017-07-09  667  
fc60a8b675bd949 Andreas Färber   2017-07-09  668  	if (owl_uart_ports[pdev->id]) {
fc60a8b675bd949 Andreas Färber   2017-07-09  669  		dev_err(&pdev->dev, "port %d already allocated\n", pdev->id);
fc60a8b675bd949 Andreas Färber   2017-07-09  670  		return -EBUSY;
fc60a8b675bd949 Andreas Färber   2017-07-09  671  	}
fc60a8b675bd949 Andreas Färber   2017-07-09  672  
fc60a8b675bd949 Andreas Färber   2017-07-09  673  	owl_port = devm_kzalloc(&pdev->dev, sizeof(*owl_port), GFP_KERNEL);
fc60a8b675bd949 Andreas Färber   2017-07-09  674  	if (!owl_port)
fc60a8b675bd949 Andreas Färber   2017-07-09  675  		return -ENOMEM;
fc60a8b675bd949 Andreas Färber   2017-07-09  676  
fc60a8b675bd949 Andreas Färber   2017-07-09  677  	owl_port->clk = devm_clk_get(&pdev->dev, NULL);
fc60a8b675bd949 Andreas Färber   2017-07-09  678  	if (IS_ERR(owl_port->clk)) {
fc60a8b675bd949 Andreas Färber   2017-07-09  679  		dev_err(&pdev->dev, "could not get clk\n");
fc60a8b675bd949 Andreas Färber   2017-07-09  680  		return PTR_ERR(owl_port->clk);
fc60a8b675bd949 Andreas Färber   2017-07-09  681  	}
fc60a8b675bd949 Andreas Färber   2017-07-09  682  
abf42d2f333b21b Amit Singh Tomar 2020-04-17  683  	ret = clk_prepare_enable(owl_port->clk);

New clk_prepare_enable().

abf42d2f333b21b Amit Singh Tomar 2020-04-17  684  	if (ret) {
abf42d2f333b21b Amit Singh Tomar 2020-04-17  685  		dev_err(&pdev->dev, "could not enable clk\n");
abf42d2f333b21b Amit Singh Tomar 2020-04-17  686  		return ret;
abf42d2f333b21b Amit Singh Tomar 2020-04-17  687  	}
abf42d2f333b21b Amit Singh Tomar 2020-04-17  688  
fc60a8b675bd949 Andreas Färber   2017-07-09  689  	owl_port->port.dev = &pdev->dev;
fc60a8b675bd949 Andreas Färber   2017-07-09  690  	owl_port->port.line = pdev->id;
fc60a8b675bd949 Andreas Färber   2017-07-09  691  	owl_port->port.type = PORT_OWL;
fc60a8b675bd949 Andreas Färber   2017-07-09  692  	owl_port->port.iotype = UPIO_MEM;
fc60a8b675bd949 Andreas Färber   2017-07-09  693  	owl_port->port.mapbase = res_mem->start;
fc60a8b675bd949 Andreas Färber   2017-07-09  694  	owl_port->port.irq = irq;
fc60a8b675bd949 Andreas Färber   2017-07-09  695  	owl_port->port.uartclk = clk_get_rate(owl_port->clk);
fc60a8b675bd949 Andreas Färber   2017-07-09  696  	if (owl_port->port.uartclk == 0) {
fc60a8b675bd949 Andreas Färber   2017-07-09  697  		dev_err(&pdev->dev, "clock rate is zero\n");
fc60a8b675bd949 Andreas Färber   2017-07-09  698  		return -EINVAL;

clk_disable_unprepare() on this path?

fc60a8b675bd949 Andreas Färber   2017-07-09  699  	}
fc60a8b675bd949 Andreas Färber   2017-07-09  700  	owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY;
fc60a8b675bd949 Andreas Färber   2017-07-09  701  	owl_port->port.x_char = 0;
fc60a8b675bd949 Andreas Färber   2017-07-09  702  	owl_port->port.fifosize = (info) ? info->tx_fifosize : 16;
fc60a8b675bd949 Andreas Färber   2017-07-09  703  	owl_port->port.ops = &owl_uart_ops;
fc60a8b675bd949 Andreas Färber   2017-07-09  704  
fc60a8b675bd949 Andreas Färber   2017-07-09  705  	owl_uart_ports[pdev->id] = owl_port;
fc60a8b675bd949 Andreas Färber   2017-07-09  706  	platform_set_drvdata(pdev, owl_port);
fc60a8b675bd949 Andreas Färber   2017-07-09  707  
fc60a8b675bd949 Andreas Färber   2017-07-09  708  	ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
fc60a8b675bd949 Andreas Färber   2017-07-09  709  	if (ret)
fc60a8b675bd949 Andreas Färber   2017-07-09  710  		owl_uart_ports[pdev->id] = NULL;
fc60a8b675bd949 Andreas Färber   2017-07-09  711  
fc60a8b675bd949 Andreas Färber   2017-07-09 @712  	return ret;
fc60a8b675bd949 Andreas Färber   2017-07-09  713  }

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

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

                 reply	other threads:[~2020-10-27  9:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027090024.GO1042@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=amittomer25@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox