Using dev_err_probe() instead of dev_err() in probe() simplifies the error path and standardizes the format of the error code. Signed-off-by: Yang Ruibin <11162571@xxxxxxxx> --- sound/soc/codecs/ad1980.c | 8 +++----- sound/soc/codecs/adau1701.c | 19 +++++++------------ sound/soc/codecs/ssm2602.c | 6 ++---- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 3c1ae13c1..d2f679d9d 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c @@ -237,11 +237,9 @@ static int ad1980_soc_probe(struct snd_soc_component *component) u16 ext_status; ac97 = snd_soc_new_ac97_component(component, 0, 0); - if (IS_ERR(ac97)) { - ret = PTR_ERR(ac97); - dev_err(component->dev, "Failed to register AC97 component: %d\n", ret); - return ret; - } + if (IS_ERR(ac97)) + return dev_err_probe(component->dev, PTR_ERR(ac97), + "Failed to register AC97 component\n"); regmap = regmap_init_ac97(ac97, &ad1980_regmap_config); if (IS_ERR(regmap)) { diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 8bd6067df..f4c574447 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -677,10 +677,9 @@ static int adau1701_probe(struct snd_soc_component *component) ret = regulator_bulk_enable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - if (ret < 0) { - dev_err(component->dev, "Failed to enable regulators: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(component->dev, ret, + "Failed to enable regulators\n"); /* * Let the pll_clkdiv variable default to something that won't happen @@ -798,17 +797,13 @@ static int adau1701_i2c_probe(struct i2c_client *client) ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - if (ret < 0) { - dev_err(dev, "Failed to get regulators: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to get regulators\n"); ret = regulator_bulk_enable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - if (ret < 0) { - dev_err(dev, "Failed to enable regulators: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to enable regulators\n"); adau1701->client = client; adau1701->regmap = devm_regmap_init(dev, NULL, client, diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index c29324403..153eb55a3 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -605,10 +605,8 @@ static int ssm260x_component_probe(struct snd_soc_component *component) int ret; ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0); - if (ret < 0) { - dev_err(component->dev, "Failed to issue reset: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(component->dev, ret, "Failed to issue reset\n"); regmap_register_patch(ssm2602->regmap, ssm2602_patch, ARRAY_SIZE(ssm2602_patch)); -- 2.34.1