Skip to content

Commit ac18935

Browse files
Sam Protsenkowsakernel
authored andcommitted
i2c: exynos5: Fix getting the optional clock
"hsi2c_pclk" clock is optional and may not be present for some SoCs supported by this driver. Nevertheless, in case the clock is provided but some error happens during its getting, that error should be handled properly. Use devm_clk_get_optional() API for that. Also report possible errors using dev_err_probe() to handle properly -EPROBE_DEFER error (if clock provider is not ready by the time I2C probe function is executed). Fixes: 697ad24 ("i2c: exynos5: Add bus clock support") Signed-off-by: Sam Protsenko <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Chanho Park <[email protected]> [wsa: fixed SHA1 of Fixes tag] Signed-off-by: Wolfram Sang <[email protected]>
1 parent 2759181 commit ac18935

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/i2c/busses/i2c-exynos5.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,11 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
814814
return -ENOENT;
815815
}
816816

817-
i2c->pclk = devm_clk_get(&pdev->dev, "hsi2c_pclk");
818-
if (IS_ERR(i2c->pclk))
819-
i2c->pclk = NULL; /* pclk is optional */
817+
i2c->pclk = devm_clk_get_optional(&pdev->dev, "hsi2c_pclk");
818+
if (IS_ERR(i2c->pclk)) {
819+
return dev_err_probe(&pdev->dev, PTR_ERR(i2c->pclk),
820+
"cannot get pclk");
821+
}
820822

821823
ret = clk_prepare_enable(i2c->pclk);
822824
if (ret)

0 commit comments

Comments
 (0)