[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZSPSDcPY5c1UzrM2@x1-carbon>
Date: Mon, 9 Oct 2023 10:12:35 +0000
From: Niklas Cassel <Niklas.Cassel@....com>
To: Ma Ke <make_ruc2021@....com>
CC: "dlemoal@...nel.org" <dlemoal@...nel.org>,
"linux-ide@...r.kernel.org" <linux-ide@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ata: sata_mv: aspeed: fix value check in
mv_platform_probe()
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@....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
Powered by blists - more mailing lists