* [PATCH] ata: sata_mv: aspeed: fix value check in mv_platform_probe()
@ 2023-10-07 7:26 Ma Ke
2023-10-09 10:12 ` Niklas Cassel
0 siblings, 1 reply; 2+ messages in thread
From: Ma Ke @ 2023-10-07 7:26 UTC (permalink / raw)
To: dlemoal; +Cc: linux-ide, linux-kernel, Ma Ke
In mv_platform_probe(), check the return value of clk_prepare_enable()
and return the error code if clk_prepare_enable() returns an
unexpected value.
Signed-off-by: Ma Ke <make_ruc2021@163.com>
---
drivers/ata/sata_mv.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 45e48d653c60..96f9841aae6c 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4125,8 +4125,11 @@ static int mv_platform_probe(struct platform_device *pdev)
hpriv->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(hpriv->clk))
dev_notice(&pdev->dev, "cannot get optional clkdev\n");
- else
- clk_prepare_enable(hpriv->clk);
+ else {
+ rc = clk_prepare_enable(hpriv->clk);
+ if (rc)
+ return rc;
+ }
for (port = 0; port < n_ports; port++) {
char port_number[16];
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ata: sata_mv: aspeed: fix value check in mv_platform_probe()
2023-10-07 7:26 [PATCH] ata: sata_mv: aspeed: fix value check in mv_platform_probe() Ma Ke
@ 2023-10-09 10:12 ` Niklas Cassel
0 siblings, 0 replies; 2+ messages in thread
From: Niklas Cassel @ 2023-10-09 10:12 UTC (permalink / raw)
To: Ma Ke
Cc: dlemoal@kernel.org, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sat, Oct 07, 2023 at 03:26:57PM +0800, Ma Ke wrote:
> In mv_platform_probe(), check the return value of clk_prepare_enable()
> and return the error code if clk_prepare_enable() returns an
> unexpected value.
>
> Signed-off-by: Ma Ke <make_ruc2021@163.com>
> ---
> drivers/ata/sata_mv.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 45e48d653c60..96f9841aae6c 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -4125,8 +4125,11 @@ static int mv_platform_probe(struct platform_device *pdev)
> hpriv->clk = clk_get(&pdev->dev, NULL);
> if (IS_ERR(hpriv->clk))
> dev_notice(&pdev->dev, "cannot get optional clkdev\n");
> - else
> - clk_prepare_enable(hpriv->clk);
> + else {
> + rc = clk_prepare_enable(hpriv->clk);
> + if (rc)
> + return rc;
Don't you also need to call clk_put() to undo the clk_get()?
Can this error path perhaps simply do a goto err?
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-09 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-07 7:26 [PATCH] ata: sata_mv: aspeed: fix value check in mv_platform_probe() Ma Ke
2023-10-09 10:12 ` Niklas Cassel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox