drivers/tty/serial/owl-uart.c:712 owl_uart_probe() warn: 'owl_port->clk' not released on lines: 698.
From: Dan Carpenter
Date: Tue Oct 27 2020 - 05:03:06 EST
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@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
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@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip