Skip to content

Commit

Permalink
ata: sata_rcar: Handle return value of clk_prepare_enable
Browse files Browse the repository at this point in the history
Here, Clock enable can failed. So adding an error check for
clk_prepare_enable.

tj: minor style updates

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Arvind Yadav authored and Tejun Heo committed May 16, 2017
1 parent 8bfd174 commit 5dc63fd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/ata/sata_rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,10 @@ static int sata_rcar_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to get access to sata clock\n");
return PTR_ERR(priv->clk);
}
clk_prepare_enable(priv->clk);

ret = clk_prepare_enable(priv->clk);
if (ret)
return ret;

host = ata_host_alloc(&pdev->dev, 1);
if (!host) {
Expand Down Expand Up @@ -970,8 +973,11 @@ static int sata_rcar_resume(struct device *dev)
struct ata_host *host = dev_get_drvdata(dev);
struct sata_rcar_priv *priv = host->private_data;
void __iomem *base = priv->base;
int ret;

clk_prepare_enable(priv->clk);
ret = clk_prepare_enable(priv->clk);
if (ret)
return ret;

/* ack and mask */
iowrite32(0, base + SATAINTSTAT_REG);
Expand All @@ -988,8 +994,11 @@ static int sata_rcar_restore(struct device *dev)
{
struct ata_host *host = dev_get_drvdata(dev);
struct sata_rcar_priv *priv = host->private_data;
int ret;

clk_prepare_enable(priv->clk);
ret = clk_prepare_enable(priv->clk);
if (ret)
return ret;

sata_rcar_setup_port(host);

Expand Down

0 comments on commit 5dc63fd

Please sign in to comment.