linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations
@ 2017-11-23 21:07 SF Markus Elfring
  2017-11-23 21:08 ` [PATCH 1/4] ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata() SF Markus Elfring
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-11-23 21:07 UTC (permalink / raw)
  To: alsa-devel, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Peter Ujfalusi, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()
  2017-11-23 21:07 [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations SF Markus Elfring
@ 2017-11-23 21:08 ` SF Markus Elfring
  2017-11-27 18:54   ` Applied "ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()" to the asoc tree Mark Brown
  2017-11-23 21:10 ` [PATCH 2/4] ASoC: twl4030: Use common error handling code in twl4030_get_pdata() SF Markus Elfring
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: SF Markus Elfring @ 2017-11-23 21:08 UTC (permalink / raw)
  To: alsa-devel, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Peter Ujfalusi, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/soc/codecs/twl4030.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index cfe72b9d4356..90691701b082 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -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;
 		}
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] ASoC: twl4030: Use common error handling code in twl4030_get_pdata()
  2017-11-23 21:07 [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations SF Markus Elfring
  2017-11-23 21:08 ` [PATCH 1/4] ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata() SF Markus Elfring
@ 2017-11-23 21:10 ` SF Markus Elfring
  2017-11-23 21:11 ` [PATCH 3/4] ASoC: twl4030: Improve a size determination in two functions SF Markus Elfring
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-11-23 21:10 UTC (permalink / raw)
  To: alsa-devel, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Peter Ujfalusi, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/soc/codecs/twl4030.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 90691701b082..a1f0b45c83ca 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -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);
 	}
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] ASoC: twl4030: Improve a size determination in two functions
  2017-11-23 21:07 [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations SF Markus Elfring
  2017-11-23 21:08 ` [PATCH 1/4] ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata() SF Markus Elfring
  2017-11-23 21:10 ` [PATCH 2/4] ASoC: twl4030: Use common error handling code in twl4030_get_pdata() SF Markus Elfring
@ 2017-11-23 21:11 ` SF Markus Elfring
  2017-11-23 21:12 ` [PATCH 4/4] ASoC: twl4030: Delete an unnecessary variable initialisation in twl4030_get_pdata() SF Markus Elfring
  2017-12-04 14:04 ` [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations Peter Ujfalusi
  4 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-11-23 21:11 UTC (permalink / raw)
  To: alsa-devel, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Peter Ujfalusi, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/soc/codecs/twl4030.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index a1f0b45c83ca..946818a0412c 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -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);
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] ASoC: twl4030: Delete an unnecessary variable initialisation in twl4030_get_pdata()
  2017-11-23 21:07 [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-11-23 21:11 ` [PATCH 3/4] ASoC: twl4030: Improve a size determination in two functions SF Markus Elfring
@ 2017-11-23 21:12 ` SF Markus Elfring
  2017-12-04 14:04 ` [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations Peter Ujfalusi
  4 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-11-23 21:12 UTC (permalink / raw)
  To: alsa-devel, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Peter Ujfalusi, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/soc/codecs/twl4030.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 946818a0412c..3ea6117beceb 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -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");
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Applied "ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()" to the asoc tree
  2017-11-23 21:08 ` [PATCH 1/4] ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata() SF Markus Elfring
@ 2017-11-27 18:54   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2017-11-27 18:54 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Mark Brown, alsa-devel, Jaroslav Kysela, Liam Girdwood,
	Mark Brown, Peter Ujfalusi, Takashi Iwai, kernel-janitors, LKML,
	alsa-devel

The 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

>From 2dbb29cd977fc281f71f8895abce7e382efe77e1 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/twl4030.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index cfe72b9d4356..90691701b082 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -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;
 		}
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations
  2017-11-23 21:07 [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2017-11-23 21:12 ` [PATCH 4/4] ASoC: twl4030: Delete an unnecessary variable initialisation in twl4030_get_pdata() SF Markus Elfring
@ 2017-12-04 14:04 ` Peter Ujfalusi
  4 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2017-12-04 14:04 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Jaroslav Kysela, Liam Girdwood,
	Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors



On 2017-11-23 23:07, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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()

All:
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> 
>  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-04 14:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23 21:07 [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations SF Markus Elfring
2017-11-23 21:08 ` [PATCH 1/4] ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata() SF Markus Elfring
2017-11-27 18:54   ` Applied "ASoC: twl4030: Delete an error message for a failed memory allocation in twl4030_get_pdata()" to the asoc tree Mark Brown
2017-11-23 21:10 ` [PATCH 2/4] ASoC: twl4030: Use common error handling code in twl4030_get_pdata() SF Markus Elfring
2017-11-23 21:11 ` [PATCH 3/4] ASoC: twl4030: Improve a size determination in two functions SF Markus Elfring
2017-11-23 21:12 ` [PATCH 4/4] ASoC: twl4030: Delete an unnecessary variable initialisation in twl4030_get_pdata() SF Markus Elfring
2017-12-04 14:04 ` [PATCH 0/4] ALSA SoC TWL4030: Adjustments for two function implementations Peter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).