ata: sata_mv: aspeed: fix value check in mv_platform_probe()
authorMa Ke <make_ruc2021@163.com>
Tue, 10 Oct 2023 12:29:16 +0000 (20:29 +0800)
committerDamien Le Moal <dlemoal@kernel.org>
Wed, 11 Oct 2023 08:51:53 +0000 (17:51 +0900)
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>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
drivers/ata/sata_mv.c

index 45e48d653c60b5556557e4e4d12666a32b7563aa..e82786c63fbd73decc4af68d1a3aff1113411a27 100644 (file)
@@ -4123,10 +4123,13 @@ static int mv_platform_probe(struct platform_device *pdev)
        hpriv->base -= SATAHC0_REG_BASE;
 
        hpriv->clk = clk_get(&pdev->dev, NULL);
-       if (IS_ERR(hpriv->clk))
+       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)
+                       goto err;
+       }
 
        for (port = 0; port < n_ports; port++) {
                char port_number[16];