lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240829072016.2329466-1-11162571@vivo.com>
Date: Thu, 29 Aug 2024 15:20:16 +0800
From: Yang Ruibin <11162571@...o.com>
To: Lars-Peter Clausen <lars@...afoo.de>,
	Nuno Sá <nuno.sa@...log.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	alsa-devel@...a-project.org,
	linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com,
	Yang Ruibin <11162571@...o.com>
Subject: [PATCH v1] ASoC: codecs: Simplify with dev_err_probe()

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@...o.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,
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ