Fwd: [PATCH] tty:Insert clk_put before return (clk) to release memory

liubin001@208suo.com posted 1 patch 2 years, 6 months ago
drivers/tty/serial/bcm63xx_uart.c | 1 +
1 file changed, 1 insertion(+)
Fwd: [PATCH] tty:Insert clk_put before return (clk) to release memory
Posted by liubin001@208suo.com 2 years, 6 months ago

tty/serial:Insert clk_put before return (clk) to release memory
Signed-off-by: Liu Bin <liubin001@08suo.com>
---
  drivers/tty/serial/bcm63xx_uart.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/bcm63xx_uart.c 
b/drivers/tty/serial/bcm63xx_uart.c
index 55e82d0bf92d..7353b683952d 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -851,6 +851,7 @@ static int bcm_uart_probe(struct platform_device 
*pdev)
          clk = of_clk_get(pdev->dev.of_node, 0);

      if (IS_ERR(clk))
+        clk_put(clk);
          return -ENODEV;

      port->iotype = UPIO_MEM;
Re: Fwd: [PATCH] tty:Insert clk_put before return (clk) to release memory
Posted by Greg KH 2 years, 6 months ago
On Fri, Jul 14, 2023 at 12:30:14PM +0800, liubin001@208suo.com wrote:
> 
> tty/serial:Insert clk_put before return (clk) to release memory
> Signed-off-by: Liu Bin <liubin001@08suo.com>
> ---
>  drivers/tty/serial/bcm63xx_uart.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/serial/bcm63xx_uart.c
> b/drivers/tty/serial/bcm63xx_uart.c
> index 55e82d0bf92d..7353b683952d 100644
> --- a/drivers/tty/serial/bcm63xx_uart.c
> +++ b/drivers/tty/serial/bcm63xx_uart.c
> @@ -851,6 +851,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
>          clk = of_clk_get(pdev->dev.of_node, 0);
> 
>      if (IS_ERR(clk))
> +        clk_put(clk);
>          return -ENODEV;
> 
>      port->iotype = UPIO_MEM;

This obviously has not even been tested :(
Re: Fwd: [PATCH] tty:Insert clk_put before return (clk) to release memory
Posted by Ilpo Järvinen 2 years, 6 months ago
On Fri, 14 Jul 2023, liubin001@208suo.com wrote:

> 
> tty/serial:Insert clk_put before return (clk) to release memory
> Signed-off-by: Liu Bin <liubin001@08suo.com>
> ---
>  drivers/tty/serial/bcm63xx_uart.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/serial/bcm63xx_uart.c
> b/drivers/tty/serial/bcm63xx_uart.c
> index 55e82d0bf92d..7353b683952d 100644
> --- a/drivers/tty/serial/bcm63xx_uart.c
> +++ b/drivers/tty/serial/bcm63xx_uart.c
> @@ -851,6 +851,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
>          clk = of_clk_get(pdev->dev.of_node, 0);
> 
>      if (IS_ERR(clk))
> +        clk_put(clk);
>          return -ENODEV;

Braces missing... Didn't checkpatch complain about this?

-- 
 i.