* [PATCH -next] serial: milbeaut_usio: Fix error handling in probe and remove
@ 2019-04-25 15:10 Wei Yongjun
2019-04-26 10:39 ` Sugaya, Taichi
2019-04-30 9:35 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2019-04-25 15:10 UTC (permalink / raw)
To: kernel-janitors
devm_clk_get() is used so there is no reason to explicitly call
clk_put() in probe or remove functions. Also remove duplicate assign
for port->membase.
Fixes: ba44dc043004 ("serial: Add Milbeaut serial control")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/tty/serial/milbeaut_usio.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
index d303b7d4bb20..b960d531300c 100644
--- a/drivers/tty/serial/milbeaut_usio.c
+++ b/drivers/tty/serial/milbeaut_usio.c
@@ -525,8 +525,6 @@ static int mlb_usio_probe(struct platform_device *pdev)
ret = -ENODEV;
goto failed;
}
- port->mapbase = res->start;
- port->membase = ioremap(res->start, (res->end - res->start + 1));
port->membase = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
@@ -548,16 +546,12 @@ static int mlb_usio_probe(struct platform_device *pdev)
ret = uart_add_one_port(&mlb_usio_uart_driver, port);
if (ret) {
dev_err(&pdev->dev, "Adding port failed: %d\n", ret);
- goto failed1;
+ goto failed;
}
return 0;
-failed1:
- iounmap(port->membase);
-
failed:
clk_disable_unprepare(clk);
- clk_put(clk);
return ret;
}
@@ -569,7 +563,6 @@ static int mlb_usio_remove(struct platform_device *pdev)
uart_remove_one_port(&mlb_usio_uart_driver, port);
clk_disable_unprepare(clk);
- clk_put(clk);
return 0;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -next] serial: milbeaut_usio: Fix error handling in probe and remove
2019-04-25 15:10 [PATCH -next] serial: milbeaut_usio: Fix error handling in probe and remove Wei Yongjun
@ 2019-04-26 10:39 ` Sugaya, Taichi
2019-04-30 9:35 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Sugaya, Taichi @ 2019-04-26 10:39 UTC (permalink / raw)
To: kernel-janitors
Hi,
Thank you for the fixes patch.
On 2019/04/26 0:10, Wei Yongjun wrote:
> devm_clk_get() is used so there is no reason to explicitly call
> clk_put() in probe or remove functions. Also remove duplicate assign
> for port->membase.
>
> Fixes: ba44dc043004 ("serial: Add Milbeaut serial control")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> drivers/tty/serial/milbeaut_usio.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
> index d303b7d4bb20..b960d531300c 100644
> --- a/drivers/tty/serial/milbeaut_usio.c
> +++ b/drivers/tty/serial/milbeaut_usio.c
> @@ -525,8 +525,6 @@ static int mlb_usio_probe(struct platform_device *pdev)
> ret = -ENODEV;
> goto failed;
> }
> - port->mapbase = res->start;
> - port->membase = ioremap(res->start, (res->end - res->start + 1));
> port->membase = devm_ioremap(&pdev->dev, res->start,
> resource_size(res));
>
> @@ -548,16 +546,12 @@ static int mlb_usio_probe(struct platform_device *pdev)
> ret = uart_add_one_port(&mlb_usio_uart_driver, port);
> if (ret) {
> dev_err(&pdev->dev, "Adding port failed: %d\n", ret);
> - goto failed1;
> + goto failed;
> }
> return 0;
>
> -failed1:
> - iounmap(port->membase);
> -
> failed:
> clk_disable_unprepare(clk);
> - clk_put(clk);
>
> return ret;
> }
> @@ -569,7 +563,6 @@ static int mlb_usio_remove(struct platform_device *pdev)
>
> uart_remove_one_port(&mlb_usio_uart_driver, port);
> clk_disable_unprepare(clk);
> - clk_put(clk);
>
> return 0;
> }
>
>
>
Tested-by: Sugaya Taichi <sugaya.taichi@socionext.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH -next] serial: milbeaut_usio: Fix error handling in probe and remove
2019-04-25 15:10 [PATCH -next] serial: milbeaut_usio: Fix error handling in probe and remove Wei Yongjun
2019-04-26 10:39 ` Sugaya, Taichi
@ 2019-04-30 9:35 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-04-30 9:35 UTC (permalink / raw)
To: kernel-janitors
On Thu, Apr 25, 2019 at 03:10:44PM +0000, Wei Yongjun wrote:
> devm_clk_get() is used so there is no reason to explicitly call
> clk_put() in probe or remove functions.
Your patch is correct, but next time the patch description should be
more clear that this is a double free. To me the patch description
sounded like it was just tidying up or something instead of fixing a
crash. It might feel rude to say that the original code will crash, but
we are all human so introducing crashing bugs is not something to be
embarrassed about.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-30 9:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-25 15:10 [PATCH -next] serial: milbeaut_usio: Fix error handling in probe and remove Wei Yongjun
2019-04-26 10:39 ` Sugaya, Taichi
2019-04-30 9:35 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox