ALSA SoC TWL4030: Adjustments for two function implementations
Subsystems (3)
cover ALSA SoC TWL4030: Adjustments for two function implementations
From: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 22:02:44 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Delete an error message for a failed memory allocation in twl4030_get_pdata() Use common error handling code in twl4030_get_pdata()
Improve a size determination in two functions
Delete an unnecessary variable initialisation in twl4030_get_pdata()
sound/soc/codecs/twl4030.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
Signature · 1 line
2.15.0
PATCH 1/4 ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()
From: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 21:30:07 +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/twl4030.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/twl4030.c +0 -1
@@ -240,7 +240,6 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec)sizeof (struct twl4030_codec_data ), GFP_KERNEL);if (!pdata) { -dev_err (codec->dev,"Can not allocate memory\n" );of_node_put (twl4030_codec_node);return NULL ; }
Signature · 1 line
2.15.0
PATCH 2/4 ASoC: twl4030: Use common error handling code in twl4030_get_pdata()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 21:35:28 +0100
Add a jump target so that a bit of exception handling can be better reused in an if branch of this function.
--- sound/soc/codecs/twl4030.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/twl4030.c +4 -4
@@ -239,11 +239,11 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec) pdata =devm_kzalloc (codec->dev,sizeof (struct twl4030_codec_data ),GFP_KERNEL ); -if (!pdata) { -of_node_put (twl4030_codec_node); -return NULL ; - } +if (!pdata) + goto put_node; +twl4030_setup_pdata_of (pdata, twl4030_codec_node); +put_node:of_node_put (twl4030_codec_node); }
Signature · 1 line
2.15.0
PATCH 3/4 ASoC: twl4030: Improve a size determination in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 21:45:55 +0100
Replace the specification of 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/twl4030.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
sound/soc/codecs/twl4030.c +2 -5
@@ -236,9 +236,7 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec) "codec");if (!pdata && twl4030_codec_node) { - pdata =devm_kzalloc (codec->dev, -sizeof (struct twl4030_codec_data ), -GFP_KERNEL ); + pdata =devm_kzalloc (codec->dev,sizeof (*pdata),GFP_KERNEL );if (!pdata) goto put_node;
@@ -2168,8 +2166,7 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec) {struct twl4030_priv *twl4030; - twl4030 =devm_kzalloc (codec->dev,sizeof (struct twl4030_priv ), -GFP_KERNEL ); + twl4030 =devm_kzalloc (codec->dev,sizeof (*twl4030),GFP_KERNEL );if (!twl4030)return -ENOMEM ;snd_soc_codec_set_drvdata (codec, twl4030);
Signature · 1 line
2.15.0
PATCH 4/4 ASoC: twl4030: Delete an unnecessary variable initialisation in twl4030_get_pdata()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 21:54:10 +0100
The variable "twl4030_codec_node" will be reassigned by a following statement.
Thus omit the explicit initialisation at the beginning.
--- sound/soc/codecs/twl4030.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/twl4030.c +1 -1
@@ -230,7 +230,7 @@ static void twl4030_setup_pdata_of(struct twl4030_codec_data *pdata,static struct twl4030_codec_data *twl4030_get_pdata (struct snd_soc_codec *codec) {struct twl4030_codec_data *pdata =dev_get_platdata (codec->dev); -struct device_node *twl4030_codec_node =NULL ; +struct device_node *twl4030_codec_node; twl4030_codec_node =of_get_child_by_name (codec->dev->parent->of_node,"codec" );
Signature · 1 line
2.15.0
Mark Brown
maintainerApplied "ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()" to the asoc tree
In reply to SF Markus ElfringThe patch
ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()
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
2dbb29cd977fc281f71f8895abce7e382efe77e1Mon Sep 17 00:00:00 2001
From: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 21:30:07 +0100
Subject: [PATCH] ASoC: twl4030: Delete an error message for a failed memory
allocation in twl4030_get_pdata()
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- sound/soc/codecs/twl4030.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/twl4030.c +0 -1
@@ -240,7 +240,6 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec)sizeof (struct twl4030_codec_data ), GFP_KERNEL);if (!pdata) { -dev_err (codec->dev,"Can not allocate memory\n" );of_node_put (twl4030_codec_node);return NULL ; }
Signature · 1 line
2.15.0
Quoted 11 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Thu, 23 Nov 2017 22:02:44 +0100A few update suggestions were taken into account
from static source code analysis.Markus Elfring (4):
Delete an error message for a failed memory allocation intwl4030_get_pdata()Use common error handling code intwl4030_get_pdata()
Improve a size determination in two functions
Delete an unnecessary variable initialisation intwl4030_get_pdata()
All:
Quoted 4 lines
sound/soc/codecs/twl4030.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel