Commit b59f7650 authored by Fabien Dessenne's avatar Fabien Dessenne Committed by Greg Kroah-Hartman

iio: adc: stm32-dfsdm: missing error case during probe

[ Upstream commit d2fc0156 ]

During probe, check the devm_ioremap_resource() error value.
Also return the devm_clk_get() error value instead of -EINVAL.
Signed-off-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
Acked-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 302e4cdc
...@@ -213,6 +213,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev, ...@@ -213,6 +213,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
} }
priv->dfsdm.phys_base = res->start; priv->dfsdm.phys_base = res->start;
priv->dfsdm.base = devm_ioremap_resource(&pdev->dev, res); priv->dfsdm.base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->dfsdm.base))
return PTR_ERR(priv->dfsdm.base);
/* /*
* "dfsdm" clock is mandatory for DFSDM peripheral clocking. * "dfsdm" clock is mandatory for DFSDM peripheral clocking.
...@@ -222,8 +224,10 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev, ...@@ -222,8 +224,10 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
*/ */
priv->clk = devm_clk_get(&pdev->dev, "dfsdm"); priv->clk = devm_clk_get(&pdev->dev, "dfsdm");
if (IS_ERR(priv->clk)) { if (IS_ERR(priv->clk)) {
dev_err(&pdev->dev, "No stm32_dfsdm_clk clock found\n"); ret = PTR_ERR(priv->clk);
return -EINVAL; if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "Failed to get clock (%d)\n", ret);
return ret;
} }
priv->aclk = devm_clk_get(&pdev->dev, "audio"); priv->aclk = devm_clk_get(&pdev->dev, "audio");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment