i2c: p2wi: use dev_err_probe() for clock and reset errors
Subsystems (2)
PATCH 1/1 i2c: p2wi: use dev_err_probe() for clock and reset errors
Replace open-coded error logging and returns with dev_err_probe() when acquiring the clock and reset controller in probe.
This makes the error handling more concise and correctly handles deferred probe.
Signed-off-by Adeel Zahid <[email protected]>
--- drivers/i2c/busses/i2c-sun6i-p2wi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/i2c/busses/i2c-sun6i-p2wi.c +6 -10
@@ -245,20 +245,16 @@ static int p2wi_probe(struct platform_device *pdev)return irq; p2wi->clk =devm_clk_get_enabled (dev,NULL ); -if (IS_ERR (p2wi->clk)) { - ret =PTR_ERR (p2wi->clk); -dev_err (dev,"failed to enable clk: %d\n" , ret); -return ret; - } +if (IS_ERR (p2wi->clk)) +return dev_err_probe (dev,PTR_ERR (p2wi->clk), +"failed to enable clk\n" ); parent_clk_freq =clk_get_rate (p2wi->clk); p2wi->rstc =devm_reset_control_get_exclusive (dev,NULL ); -if (IS_ERR (p2wi->rstc)) { -dev_err (dev,"failed to retrieve reset controller: %pe\n" , - p2wi->rstc); -return PTR_ERR (p2wi->rstc); - } +if (IS_ERR (p2wi->rstc)) +return dev_err_probe (dev,PTR_ERR (p2wi->rstc), +"failed to retrieve reset controller\n" ); ret =reset_control_deassert (p2wi->rstc);if (ret) {
Signature · 1 line
2.43.0