Skip to content

Commit f6a3053

Browse files
lategoodbyestorulf
authored andcommitted
pmdomain: bcm: bcm2835-power: Use devm_clk_get_optional
The driver tries to implement optional clock handling with devm_clk_get. It treats all errors except EPROBE_DEFER as a missing clock, which is not correct. So use devm_clk_get_optional here and get the corner-cases right. Signed-off-by: Stefan Wahren <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent f89c082 commit f6a3053

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

drivers/pmdomain/bcm/bcm2835-power.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -506,18 +506,10 @@ bcm2835_init_power_domain(struct bcm2835_power *power,
506506
struct device *dev = power->dev;
507507
struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index];
508508

509-
dom->clk = devm_clk_get(dev->parent, name);
510-
if (IS_ERR(dom->clk)) {
511-
int ret = PTR_ERR(dom->clk);
512-
513-
if (ret == -EPROBE_DEFER)
514-
return ret;
515-
516-
/* Some domains don't have a clk, so make sure that we
517-
* don't deref an error pointer later.
518-
*/
519-
dom->clk = NULL;
520-
}
509+
dom->clk = devm_clk_get_optional(dev->parent, name);
510+
if (IS_ERR(dom->clk))
511+
return dev_err_probe(dev, PTR_ERR(dom->clk), "Failed to get clock %s\n",
512+
name);
521513

522514
dom->base.name = name;
523515
dom->base.flags = GENPD_FLAG_ACTIVE_WAKEUP;

0 commit comments

Comments
 (0)