Skip to contentSkip to conversation

ASoC-cs42l73: Adjustments for two function implementations

PATCH In review SF Markus Elfring 3 participants 8 messages Nov 22, 2017 – Nov 27, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ASoC-cs42l73: Adjustments for two function implementations

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 16:38:32 +0100

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Delete an error message for a failed memory allocation in cs42l73_i2c_probe() Improve two size determinations in cs42l73_i2c_probe()
Fix a typo in two comments

 sound/soc/codecs/cs42l73.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.15.0
#1 lore raw

PATCH 1/3 ASoC: cs42l73: Delete an error message for a failed memory allocation in cs42l73_i2c_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 15:50:46 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 sound/soc/codecs/cs42l73.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
sound/soc/codecs/cs42l73.c +2 -3
index 3df2c473ab88..978cfbbad408 100644
@@ -1307,10 +1307,9 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
 		pdata = devm_kzalloc(&i2c_client->dev,
 				     sizeof(struct cs42l73_platform_data),
 				GFP_KERNEL);
-		if (!pdata) {
-			dev_err(&i2c_client->dev, "could not allocate pdata\n");
+		if (!pdata)
 			return -ENOMEM;
-		}
+
 		if (i2c_client->dev.of_node) {
 			if (of_property_read_u32(i2c_client->dev.of_node,
 				"chgfreq", &val32) >= 0)
Signature · 1 line
2.15.0
maintainer
#2 lore raw

Applied "ASoC: cs42l73: Delete an error message for a failed memory allocation in cs42l73_i2c_probe()" to the asoc tree

The patch

ASoC: cs42l73: Delete an error message for a failed memory allocation in cs42l73_i2c_probe()

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From ddedd797943df21a2464420744d117e930a43af8 Mon Sep 17 00:00:00 2001

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 15:50:46 +0100
Subject: [PATCH] ASoC: cs42l73: Delete an error message for a failed memory
allocation in cs42l73_i2c_probe()

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 sound/soc/codecs/cs42l73.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
sound/soc/codecs/cs42l73.c +2 -3
index 3df2c473ab88..978cfbbad408 100644
@@ -1307,10 +1307,9 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
 		pdata = devm_kzalloc(&i2c_client->dev,
 				     sizeof(struct cs42l73_platform_data),
 				GFP_KERNEL);
-		if (!pdata) {
-			dev_err(&i2c_client->dev, "could not allocate pdata\n");
+		if (!pdata)
 			return -ENOMEM;
-		}
+
 		if (i2c_client->dev.of_node) {
 			if (of_property_read_u32(i2c_client->dev.of_node,
 				"chgfreq", &val32) >= 0)
Signature · 1 line
2.15.0
#3 lore raw

PATCH 2/3 ASoC: cs42l73: Improve two size determinations in cs42l73_i2c_probe()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 16:07:42 +0100

Replace the specification of two data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

---
 sound/soc/codecs/cs42l73.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
sound/soc/codecs/cs42l73.c +3 -5
index 978cfbbad408..dde37e569ade 100644
@@ -1289,8 +1289,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
 	unsigned int reg;
 	u32 val32;
 
-	cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
-			       GFP_KERNEL);
+	cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l73), GFP_KERNEL);
 	if (!cs42l73)
 		return -ENOMEM;
 
@@ -1304,9 +1303,8 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
 	if (pdata) {
 		cs42l73->pdata = *pdata;
 	} else {
-		pdata = devm_kzalloc(&i2c_client->dev,
-				     sizeof(struct cs42l73_platform_data),
-				GFP_KERNEL);
+		pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
+				     GFP_KERNEL);
 		if (!pdata)
 			return -ENOMEM;
 
Signature · 1 line
2.15.0
maintainer
#4 lore raw

Applied "ASoC: cs42l73: Improve two size determinations in cs42l73_i2c_probe()" to the asoc tree

The patch

ASoC: cs42l73: Improve two size determinations in cs42l73_i2c_probe()

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 68fa08c665e51b2fe100876692e57bca3aea7711 Mon Sep 17 00:00:00 2001

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 16:07:42 +0100
Subject: [PATCH] ASoC: cs42l73: Improve two size determinations in
cs42l73_i2c_probe()

Replace the specification of two data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

---
 sound/soc/codecs/cs42l73.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
sound/soc/codecs/cs42l73.c +3 -5
index 978cfbbad408..dde37e569ade 100644
@@ -1289,8 +1289,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
 	unsigned int reg;
 	u32 val32;
 
-	cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
-			       GFP_KERNEL);
+	cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(*cs42l73), GFP_KERNEL);
 	if (!cs42l73)
 		return -ENOMEM;
 
@@ -1304,9 +1303,8 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
 	if (pdata) {
 		cs42l73->pdata = *pdata;
 	} else {
-		pdata = devm_kzalloc(&i2c_client->dev,
-				     sizeof(struct cs42l73_platform_data),
-				GFP_KERNEL);
+		pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
+				     GFP_KERNEL);
 		if (!pdata)
 			return -ENOMEM;
 
Signature · 1 line
2.15.0
#5 lore raw

PATCH 3/3 ASoC: cs42l73: Fix a typo in two comments

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 16:26:27 +0100

Add a missing character in these descriptions.

---
 sound/soc/codecs/cs42l73.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/codecs/cs42l73.c +3 -4
index dde37e569ade..928036eeb11f 100644
@@ -763,7 +763,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
 	{"ASPOUTL", "ASP-IP Volume", "ASPL Output Mixer"},
 	{"ASPOUTR", "ASP-IP Volume", "ASPR Output Mixer"},
 
-	/* Auxillary Capture */
+	/* Auxiliary Capture */
 	{"XSPL Output Mixer", NULL, "Input Left Capture"},
 	{"XSPR Output Mixer", NULL, "Input Right Capture"},
 
@@ -1127,9 +1127,8 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec,
 			mdelay(cs42l73->shutdwn_delay);
 			cs42l73->shutdwn_delay = 0;
 		} else {
-			mdelay(15); /* Min amount of time requred to power
-				     * down.
-				     */
+			/* Min amount of time required to power down. */
+			mdelay(15);
 		}
 		snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 1);
 		break;
Signature · 1 line
2.15.0
Acked-by on the v1 series
#6 lore raw
In reply to SF Markus Elfring
Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 16:38:32 +0100

Three update suggestions were taken into account
from static source code analysis.

Quoted 12 lines

Markus Elfring (3):
Delete an error message for a failed memory allocation in cs42l73_i2c_probe() Improve two size determinations in cs42l73_i2c_probe()
Fix a typo in two comments

 sound/soc/codecs/cs42l73.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.15.0

For the series, Thanks

Acked-by on the v1 series
#7 lore raw
In reply to SF Markus Elfring
Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 22 Nov 2017 16:38:32 +0100

Three update suggestions were taken into account
from static source code analysis.

Quoted 12 lines

Markus Elfring (3):
Delete an error message for a failed memory allocation in cs42l73_i2c_probe() Improve two size determinations in cs42l73_i2c_probe()
Fix a typo in two comments

 sound/soc/codecs/cs42l73.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.15.0

Sorry for the company notification that this is an external email. Very clever indeed

For the Series, Thanks