diff mbox series

[v1] ASoC: codecs: Simplify with dev_err_probe()

Message ID 20240829072016.2329466-1-11162571@vivo.com (mailing list archive)
State New, archived
Headers show
Series [v1] ASoC: codecs: Simplify with dev_err_probe() | expand

Commit Message

Yang Ruibin Aug. 29, 2024, 7:20 a.m. UTC
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@vivo.com>
---
 sound/soc/codecs/ad1980.c   |  4 ++--
 sound/soc/codecs/adau1701.c | 12 ++++++------
 sound/soc/codecs/ssm2602.c  |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

Comments

Yang Ruibin Aug. 29, 2024, 7:29 a.m. UTC | #1
Sorry, please ignore this patch for now.
The wrong title were used. This patch will be updated later.

在 2024/8/29 15:20, Yang Ruibin 写道:
> 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@vivo.com>
> ---
>   sound/soc/codecs/ad1980.c   |  4 ++--
>   sound/soc/codecs/adau1701.c | 12 ++++++------
>   sound/soc/codecs/ssm2602.c  |  4 ++--
>   3 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
> index 3c1ae13c1..25fd8bc4f 100644
> --- a/sound/soc/codecs/ad1980.c
> +++ b/sound/soc/codecs/ad1980.c
> @@ -239,8 +239,8 @@ static int ad1980_soc_probe(struct snd_soc_component *component)
>   	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;
> +		return dev_err_probe(component->dev, ret,
> +			"Failed to register AC97 component: %d\n", ret);
>   	}
>   
>   	regmap = regmap_init_ac97(ac97, &ad1980_regmap_config);
> diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
> index 8bd6067df..9fe18b22b 100644
> --- a/sound/soc/codecs/adau1701.c
> +++ b/sound/soc/codecs/adau1701.c
> @@ -678,8 +678,8 @@ 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;
> +		return dev_err_probe(component->dev, ret,
> +			"Failed to enable regulators: %d\n", ret);
>   	}
>   
>   	/*
> @@ -799,15 +799,15 @@ 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;
> +		return dev_err_probe(dev, ret,
> +			"Failed to get regulators: %d\n", ret);
>   	}
>   
>   	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;
> +		return dev_err_probe(dev, ret,
> +			"Failed to enable regulators: %d\n", ret);
>   	}
>   
>   	adau1701->client = client;
> diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
> index c29324403..727bcccad 100644
> --- a/sound/soc/codecs/ssm2602.c
> +++ b/sound/soc/codecs/ssm2602.c
> @@ -606,8 +606,8 @@ static int ssm260x_component_probe(struct snd_soc_component *component)
>   
>   	ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
>   	if (ret < 0) {
> -		dev_err(component->dev, "Failed to issue reset: %d\n", ret);
> -		return ret;
> +		return dev_err_probe(component->dev, ret,
> +			"Failed to issue reset: %d\n", ret);
>   	}
>   
>   	regmap_register_patch(ssm2602->regmap, ssm2602_patch,
diff mbox series

Patch

diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
index 3c1ae13c1..25fd8bc4f 100644
--- a/sound/soc/codecs/ad1980.c
+++ b/sound/soc/codecs/ad1980.c
@@ -239,8 +239,8 @@  static int ad1980_soc_probe(struct snd_soc_component *component)
 	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;
+		return dev_err_probe(component->dev, ret,
+			"Failed to register AC97 component: %d\n", ret);
 	}
 
 	regmap = regmap_init_ac97(ac97, &ad1980_regmap_config);
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index 8bd6067df..9fe18b22b 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -678,8 +678,8 @@  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;
+		return dev_err_probe(component->dev, ret,
+			"Failed to enable regulators: %d\n", ret);
 	}
 
 	/*
@@ -799,15 +799,15 @@  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;
+		return dev_err_probe(dev, ret,
+			"Failed to get regulators: %d\n", ret);
 	}
 
 	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;
+		return dev_err_probe(dev, ret,
+			"Failed to enable regulators: %d\n", ret);
 	}
 
 	adau1701->client = client;
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index c29324403..727bcccad 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -606,8 +606,8 @@  static int ssm260x_component_probe(struct snd_soc_component *component)
 
 	ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
 	if (ret < 0) {
-		dev_err(component->dev, "Failed to issue reset: %d\n", ret);
-		return ret;
+		return dev_err_probe(component->dev, ret,
+			"Failed to issue reset: %d\n", ret);
 	}
 
 	regmap_register_patch(ssm2602->regmap, ssm2602_patch,