mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
Input: bcm-keypad - simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe() and devm_clk_get_optional(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
This commit is contained in:
committed by
Dmitry Torokhov
parent
337ac36c3b
commit
a2c795b696
@@ -365,17 +365,11 @@ static int bcm_kp_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(kp->base);
|
||||
|
||||
/* Enable clock */
|
||||
kp->clk = devm_clk_get(&pdev->dev, "peri_clk");
|
||||
kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
|
||||
if (IS_ERR(kp->clk)) {
|
||||
error = PTR_ERR(kp->clk);
|
||||
if (error != -ENOENT) {
|
||||
if (error != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev, "Failed to get clock\n");
|
||||
return error;
|
||||
}
|
||||
dev_dbg(&pdev->dev,
|
||||
"No clock specified. Assuming it's enabled\n");
|
||||
kp->clk = NULL;
|
||||
return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
|
||||
} else if (!kp->clk) {
|
||||
dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
|
||||
} else {
|
||||
unsigned int desired_rate;
|
||||
long actual_rate;
|
||||
|
||||
Reference in New Issue
Block a user