Skip to content

Commit

Permalink
mfd: wcd934x: Simplify with dev_err_probe()
Browse files Browse the repository at this point in the history
Use dev_err_probe() to simplify code, save a few LoC and be consistent
with error codes handling in messages.
It also filters -EPROBE_DEFER that can be returned by devm_clk_get().

Signed-off-by: Christophe JAILLET <[email protected]>
Link: https://lore.kernel.org/r/73fdc6ecf619f80fad126abca11fb579d3d87f64.1684565021.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <[email protected]>
  • Loading branch information
tititiou36 authored and lag-linaro committed Jun 15, 2023
1 parent f190b48 commit 26e4462
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions drivers/mfd/wcd934x.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,9 @@ static int wcd934x_slim_probe(struct slim_device *sdev)
"Failed to get IRQ\n");

ddata->extclk = devm_clk_get(dev, "extclk");
if (IS_ERR(ddata->extclk)) {
dev_err(dev, "Failed to get extclk");
return PTR_ERR(ddata->extclk);
}
if (IS_ERR(ddata->extclk))
return dev_err_probe(dev, PTR_ERR(ddata->extclk),
"Failed to get extclk");

ddata->supplies[0].supply = "vdd-buck";
ddata->supplies[1].supply = "vdd-buck-sido";
Expand All @@ -239,16 +238,12 @@ static int wcd934x_slim_probe(struct slim_device *sdev)
ddata->supplies[4].supply = "vdd-io";

ret = regulator_bulk_get(dev, WCD934X_MAX_SUPPLY, ddata->supplies);
if (ret) {
dev_err(dev, "Failed to get supplies: err = %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to get supplies\n");

ret = regulator_bulk_enable(WCD934X_MAX_SUPPLY, ddata->supplies);
if (ret) {
dev_err(dev, "Failed to enable supplies: err = %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to enable supplies\n");

/*
* For WCD934X, it takes about 600us for the Vout_A and
Expand Down

0 comments on commit 26e4462

Please sign in to comment.