[alsa-devel] [PATCH 0/3] ASoC-cs42l73: Adjustments for two function implementations
From: Markus Elfring elfring@users.sourceforge.net 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(-)
From: Markus Elfring elfring@users.sourceforge.net 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.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- sound/soc/codecs/cs42l73.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 3df2c473ab88..978cfbbad408 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -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)
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
From ddedd797943df21a2464420744d117e930a43af8 Mon Sep 17 00:00:00 2001
From: Markus Elfring elfring@users.sourceforge.net 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.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/cs42l73.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 3df2c473ab88..978cfbbad408 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -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)
From: Markus Elfring elfring@users.sourceforge.net 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.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- sound/soc/codecs/cs42l73.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 978cfbbad408..dde37e569ade 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -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;
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
From 68fa08c665e51b2fe100876692e57bca3aea7711 Mon Sep 17 00:00:00 2001
From: Markus Elfring elfring@users.sourceforge.net 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.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/cs42l73.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 978cfbbad408..dde37e569ade 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -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;
From: Markus Elfring elfring@users.sourceforge.net Date: Wed, 22 Nov 2017 16:26:27 +0100
Add a missing character in these descriptions.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- sound/soc/codecs/cs42l73.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index dde37e569ade..928036eeb11f 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -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;
On Wed, 22 Nov 2017, SF Markus Elfring wrote:
From: Markus Elfring elfring@users.sourceforge.net 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(-)
-- 2.15.0
For the series, Thanks Acked-by: Brian Austin brian.austin@cirrus.com
On Wed, 22 Nov 2017, SF Markus Elfring wrote:
From: Markus Elfring elfring@users.sourceforge.net 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(-)
-- 2.15.0
Sorry for the company notification that this is an external email. Very clever indeed
For the Series, Thanks Acked-by: Brian Austin brian.austin@cirrus.com
participants (3)
-
Brian Austin
-
Mark Brown
-
SF Markus Elfring