Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: uniphier: Replace dev_err() with dev_err_probe() in probe function

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
Link: https://lore.kernel.org/r/20250415183447.396277-3-e.zanda1@gmail.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>

authored by

Enrico Zanda and committed by
Andi Shyti
c4f62651 ca0585ac

+8 -16
+8 -16
drivers/i2c/busses/i2c-uniphier.c
··· 327 327 if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed)) 328 328 bus_speed = I2C_MAX_STANDARD_MODE_FREQ; 329 329 330 - if (!bus_speed || bus_speed > I2C_MAX_FAST_MODE_FREQ) { 331 - dev_err(dev, "invalid clock-frequency %d\n", bus_speed); 332 - return -EINVAL; 333 - } 330 + if (!bus_speed || bus_speed > I2C_MAX_FAST_MODE_FREQ) 331 + return dev_err_probe(dev, -EINVAL, "invalid clock-frequency %d\n", bus_speed); 334 332 335 333 priv->clk = devm_clk_get_enabled(dev, NULL); 336 - if (IS_ERR(priv->clk)) { 337 - dev_err(dev, "failed to enable clock\n"); 338 - return PTR_ERR(priv->clk); 339 - } 334 + if (IS_ERR(priv->clk)) 335 + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to enable clock\n"); 340 336 341 337 clk_rate = clk_get_rate(priv->clk); 342 - if (!clk_rate) { 343 - dev_err(dev, "input clock rate should not be zero\n"); 344 - return -EINVAL; 345 - } 338 + if (!clk_rate) 339 + return dev_err_probe(dev, -EINVAL, "input clock rate should not be zero\n"); 346 340 347 341 priv->clk_cycle = clk_rate / bus_speed; 348 342 init_completion(&priv->comp); ··· 353 359 354 360 ret = devm_request_irq(dev, irq, uniphier_i2c_interrupt, 0, pdev->name, 355 361 priv); 356 - if (ret) { 357 - dev_err(dev, "failed to request irq %d\n", irq); 358 - return ret; 359 - } 362 + if (ret) 363 + return dev_err_probe(dev, ret, "failed to request irq %d\n", irq); 360 364 361 365 return i2c_add_adapter(&priv->adap); 362 366 }