All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: da7218: Adjustments for two function implementations
@ 2017-11-23 20:03 ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:03 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 21:00:12 +0100

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

Markus Elfring (3):
  Delete two error messages for a failed memory allocation
    in da7218_of_to_pdata()
  Use common error handling code in da7218_of_to_pdata()
  Improve a size determination in da7218_i2c_probe()

 sound/soc/codecs/da7218.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

-- 
2.15.0

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

* [PATCH 0/3] ASoC: da7218: Adjustments for two function implementations
@ 2017-11-23 20:03 ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:03 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 21:00:12 +0100

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

Markus Elfring (3):
  Delete two error messages for a failed memory allocation
    in da7218_of_to_pdata()
  Use common error handling code in da7218_of_to_pdata()
  Improve a size determination in da7218_i2c_probe()

 sound/soc/codecs/da7218.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

-- 
2.15.0


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

* [PATCH 0/3] ASoC: da7218: Adjustments for two function implementations
@ 2017-11-23 20:03 ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:03 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 21:00:12 +0100

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

Markus Elfring (3):
  Delete two error messages for a failed memory allocation
    in da7218_of_to_pdata()
  Use common error handling code in da7218_of_to_pdata()
  Improve a size determination in da7218_i2c_probe()

 sound/soc/codecs/da7218.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

-- 
2.15.0

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

* [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()
  2017-11-23 20:03 ` SF Markus Elfring
  (?)
@ 2017-11-23 20:04   ` SF Markus Elfring
  -1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:04 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:42:20 +0100

Omit extra messages 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/da7218.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 56564ce90cb6..25ab7443d803 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 	u32 of_val32;
 
 	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
 		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
 		if (!hpldet_pdata) {
-			dev_warn(codec->dev,
-				 "Failed to allocate memory for hpldet pdata\n");
 			of_node_put(hpldet_np);
 			return pdata;
 		}
-- 
2.15.0

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

* [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_p
@ 2017-11-23 20:04   ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:04 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:42:20 +0100

Omit extra messages 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/da7218.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 56564ce90cb6..25ab7443d803 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 	u32 of_val32;
 
 	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
 		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
 		if (!hpldet_pdata) {
-			dev_warn(codec->dev,
-				 "Failed to allocate memory for hpldet pdata\n");
 			of_node_put(hpldet_np);
 			return pdata;
 		}
-- 
2.15.0


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

* [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()
@ 2017-11-23 20:04   ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:04 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:42:20 +0100

Omit extra messages 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/da7218.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 56564ce90cb6..25ab7443d803 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 	u32 of_val32;
 
 	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
 		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
 		if (!hpldet_pdata) {
-			dev_warn(codec->dev,
-				 "Failed to allocate memory for hpldet pdata\n");
 			of_node_put(hpldet_np);
 			return pdata;
 		}
-- 
2.15.0

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

* [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
  2017-11-23 20:03 ` SF Markus Elfring
  (?)
@ 2017-11-23 20:06   ` SF Markus Elfring
  -1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:06 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:48:05 +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/da7218.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 25ab7443d803..93a0cb741751 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2524,10 +2524,9 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
-		if (!hpldet_pdata) {
-			of_node_put(hpldet_np);
-			return pdata;
-		}
+		if (!hpldet_pdata)
+			goto put_node;
+
 		pdata->hpldet_pdata = hpldet_pdata;
 
 		if (of_property_read_u32(hpldet_np, "dlg,jack-rate-us",
@@ -2561,6 +2560,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		if (of_property_read_bool(hpldet_np, "dlg,discharge"))
 			hpldet_pdata->discharge = true;
 
+put_node:
 		of_node_put(hpldet_np);
 	}
 
-- 
2.15.0

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

* [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-23 20:06   ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:06 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:48:05 +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/da7218.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 25ab7443d803..93a0cb741751 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2524,10 +2524,9 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
-		if (!hpldet_pdata) {
-			of_node_put(hpldet_np);
-			return pdata;
-		}
+		if (!hpldet_pdata)
+			goto put_node;
+
 		pdata->hpldet_pdata = hpldet_pdata;
 
 		if (of_property_read_u32(hpldet_np, "dlg,jack-rate-us",
@@ -2561,6 +2560,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		if (of_property_read_bool(hpldet_np, "dlg,discharge"))
 			hpldet_pdata->discharge = true;
 
+put_node:
 		of_node_put(hpldet_np);
 	}
 
-- 
2.15.0


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

* [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-23 20:06   ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:06 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:48:05 +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/da7218.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 25ab7443d803..93a0cb741751 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2524,10 +2524,9 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
-		if (!hpldet_pdata) {
-			of_node_put(hpldet_np);
-			return pdata;
-		}
+		if (!hpldet_pdata)
+			goto put_node;
+
 		pdata->hpldet_pdata = hpldet_pdata;
 
 		if (of_property_read_u32(hpldet_np, "dlg,jack-rate-us",
@@ -2561,6 +2560,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		if (of_property_read_bool(hpldet_np, "dlg,discharge"))
 			hpldet_pdata->discharge = true;
 
+put_node:
 		of_node_put(hpldet_np);
 	}
 
-- 
2.15.0

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

* [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe()
  2017-11-23 20:03 ` SF Markus Elfring
  (?)
@ 2017-11-23 20:07   ` SF Markus Elfring
  -1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:07 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:50:44 +0100

Replace the specification of a data structure by a pointer dereference
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/da7218.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 93a0cb741751..0c1933a98995 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	struct da7218_priv *da7218;
 	int ret;
 
-	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
-			      GFP_KERNEL);
+	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
 	if (!da7218)
 		return -ENOMEM;
 
-- 
2.15.0

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

* [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe()
@ 2017-11-23 20:07   ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:07 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:50:44 +0100

Replace the specification of a data structure by a pointer dereference
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/da7218.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 93a0cb741751..0c1933a98995 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	struct da7218_priv *da7218;
 	int ret;
 
-	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
-			      GFP_KERNEL);
+	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
 	if (!da7218)
 		return -ENOMEM;
 
-- 
2.15.0


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

* [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe()
@ 2017-11-23 20:07   ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-23 20:07 UTC (permalink / raw)
  To: alsa-devel, support.opensource, Adam Thomson, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:50:44 +0100

Replace the specification of a data structure by a pointer dereference
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/da7218.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 93a0cb741751..0c1933a98995 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	struct da7218_priv *da7218;
 	int ret;
 
-	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
-			      GFP_KERNEL);
+	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
 	if (!da7218)
 		return -ENOMEM;
 
-- 
2.15.0

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

* RE: [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()
  2017-11-23 20:04   ` [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_p SF Markus Elfring
  (?)
@ 2017-11-24 11:44     ` Adam Thomson
  -1 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 11:44 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

On 23 November 2017 20:05, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:42:20 +0100
> 
> Omit extra messages 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>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
>  sound/soc/codecs/da7218.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 56564ce90cb6..25ab7443d803 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>  	u32 of_val32;
> 
>  	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata) {
> -		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
> +	if (!pdata)
>  		return NULL;
> -	}
> 
>  	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
>  		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
> @@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>  		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
>  					    GFP_KERNEL);
>  		if (!hpldet_pdata) {
> -			dev_warn(codec->dev,
> -				 "Failed to allocate memory for hpldet pdata\n");
>  			of_node_put(hpldet_np);
>  			return pdata;
>  		}
> --
> 2.15.0

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

* RE: [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_
@ 2017-11-24 11:44     ` Adam Thomson
  0 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 11:44 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

T24gMjMgTm92ZW1iZXIgMjAxNyAyMDowNSwgU0YgTWFya3VzIEVsZnJpbmcgd3JvdGU6DQoNCj4g
RnJvbTogTWFya3VzIEVsZnJpbmcgPGVsZnJpbmdAdXNlcnMuc291cmNlZm9yZ2UubmV0Pg0KPiBE
YXRlOiBUaHUsIDIzIE5vdiAyMDE3IDIwOjQyOjIwICswMTAwDQo+IA0KPiBPbWl0IGV4dHJhIG1l
c3NhZ2VzIGZvciBhIG1lbW9yeSBhbGxvY2F0aW9uIGZhaWx1cmUgaW4gdGhpcyBmdW5jdGlvbi4N
Cj4gDQo+IFRoaXMgaXNzdWUgd2FzIGRldGVjdGVkIGJ5IHVzaW5nIHRoZSBDb2NjaW5lbGxlIHNv
ZnR3YXJlLg0KPiANCj4gU2lnbmVkLW9mZi1ieTogTWFya3VzIEVsZnJpbmcgPGVsZnJpbmdAdXNl
cnMuc291cmNlZm9yZ2UubmV0Pg0KDQpBY2tlZC1ieTogQWRhbSBUaG9tc29uIDxBZGFtLlRob21z
b24uT3BlbnNvdXJjZUBkaWFzZW1pLmNvbT4NCg0KPiAtLS0NCj4gIHNvdW5kL3NvYy9jb2RlY3Mv
ZGE3MjE4LmMgfCA2ICstLS0tLQ0KPiAgMSBmaWxlIGNoYW5nZWQsIDEgaW5zZXJ0aW9uKCspLCA1
IGRlbGV0aW9ucygtKQ0KPiANCj4gZGlmZiAtLWdpdCBhL3NvdW5kL3NvYy9jb2RlY3MvZGE3MjE4
LmMgYi9zb3VuZC9zb2MvY29kZWNzL2RhNzIxOC5jDQo+IGluZGV4IDU2NTY0Y2U5MGNiNi4uMjVh
Yjc0NDNkODAzIDEwMDY0NA0KPiAtLS0gYS9zb3VuZC9zb2MvY29kZWNzL2RhNzIxOC5jDQo+ICsr
KyBiL3NvdW5kL3NvYy9jb2RlY3MvZGE3MjE4LmMNCj4gQEAgLTI0NTUsMTAgKzI0NTUsOCBAQCBz
dGF0aWMgc3RydWN0IGRhNzIxOF9wZGF0YSAqZGE3MjE4X29mX3RvX3BkYXRhKHN0cnVjdA0KPiBz
bmRfc29jX2NvZGVjICpjb2RlYykNCj4gIAl1MzIgb2ZfdmFsMzI7DQo+IA0KPiAgCXBkYXRhID0g
ZGV2bV9remFsbG9jKGNvZGVjLT5kZXYsIHNpemVvZigqcGRhdGEpLCBHRlBfS0VSTkVMKTsNCj4g
LQlpZiAoIXBkYXRhKSB7DQo+IC0JCWRldl93YXJuKGNvZGVjLT5kZXYsICJGYWlsZWQgdG8gYWxs
b2NhdGUgbWVtb3J5IGZvciBwZGF0YVxuIik7DQo+ICsJaWYgKCFwZGF0YSkNCj4gIAkJcmV0dXJu
IE5VTEw7DQo+IC0JfQ0KPiANCj4gIAlpZiAob2ZfcHJvcGVydHlfcmVhZF91MzIobnAsICJkbGcs
bWljYmlhczEtbHZsLW1pbGxpdm9sdCIsICZvZl92YWwzMikgPj0gMCkNCj4gIAkJcGRhdGEtPm1p
Y2JpYXMxX2x2bCA9IGRhNzIxOF9vZl9taWNiaWFzX2x2bChjb2RlYywgb2ZfdmFsMzIpOw0KPiBA
QCAtMjUyNyw4ICsyNTI1LDYgQEAgc3RhdGljIHN0cnVjdCBkYTcyMThfcGRhdGEgKmRhNzIxOF9v
Zl90b19wZGF0YShzdHJ1Y3QNCj4gc25kX3NvY19jb2RlYyAqY29kZWMpDQo+ICAJCWhwbGRldF9w
ZGF0YSA9IGRldm1fa3phbGxvYyhjb2RlYy0+ZGV2LCBzaXplb2YoKmhwbGRldF9wZGF0YSksDQo+
ICAJCQkJCSAgICBHRlBfS0VSTkVMKTsNCj4gIAkJaWYgKCFocGxkZXRfcGRhdGEpIHsNCj4gLQkJ
CWRldl93YXJuKGNvZGVjLT5kZXYsDQo+IC0JCQkJICJGYWlsZWQgdG8gYWxsb2NhdGUgbWVtb3J5
IGZvciBocGxkZXQgcGRhdGFcbiIpOw0KPiAgCQkJb2Zfbm9kZV9wdXQoaHBsZGV0X25wKTsNCj4g
IAkJCXJldHVybiBwZGF0YTsNCj4gIAkJfQ0KPiAtLQ0KPiAyLjE1LjANCg0K

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

* Re: [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()
@ 2017-11-24 11:44     ` Adam Thomson
  0 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 11:44 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

On 23 November 2017 20:05, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:42:20 +0100
> 
> Omit extra messages 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>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
>  sound/soc/codecs/da7218.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 56564ce90cb6..25ab7443d803 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>  	u32 of_val32;
> 
>  	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata) {
> -		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
> +	if (!pdata)
>  		return NULL;
> -	}
> 
>  	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
>  		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
> @@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>  		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
>  					    GFP_KERNEL);
>  		if (!hpldet_pdata) {
> -			dev_warn(codec->dev,
> -				 "Failed to allocate memory for hpldet pdata\n");
>  			of_node_put(hpldet_np);
>  			return pdata;
>  		}
> --
> 2.15.0

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

* RE: [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe()
  2017-11-23 20:07   ` SF Markus Elfring
  (?)
@ 2017-11-24 11:50     ` Adam Thomson
  -1 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 11:50 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

On 23 November 2017 20:08, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:50:44 +0100
> 
> Replace the specification of a data structure by a pointer dereference
> 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>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
>  sound/soc/codecs/da7218.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 93a0cb741751..0c1933a98995 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
>  	struct da7218_priv *da7218;
>  	int ret;
> 
> -	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
> -			      GFP_KERNEL);
> +	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
>  	if (!da7218)
>  		return -ENOMEM;
> 
> --
> 2.15.0

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

* RE: [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe()
@ 2017-11-24 11:50     ` Adam Thomson
  0 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 11:50 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

T24gMjMgTm92ZW1iZXIgMjAxNyAyMDowOCwgU0YgTWFya3VzIEVsZnJpbmcgd3JvdGU6DQoNCj4g
RnJvbTogTWFya3VzIEVsZnJpbmcgPGVsZnJpbmdAdXNlcnMuc291cmNlZm9yZ2UubmV0Pg0KPiBE
YXRlOiBUaHUsIDIzIE5vdiAyMDE3IDIwOjUwOjQ0ICswMTAwDQo+IA0KPiBSZXBsYWNlIHRoZSBz
cGVjaWZpY2F0aW9uIG9mIGEgZGF0YSBzdHJ1Y3R1cmUgYnkgYSBwb2ludGVyIGRlcmVmZXJlbmNl
DQo+IGFzIHRoZSBwYXJhbWV0ZXIgZm9yIHRoZSBvcGVyYXRvciAic2l6ZW9mIiB0byBtYWtlIHRo
ZSBjb3JyZXNwb25kaW5nIHNpemUNCj4gZGV0ZXJtaW5hdGlvbiBhIGJpdCBzYWZlciBhY2NvcmRp
bmcgdG8gdGhlIExpbnV4IGNvZGluZyBzdHlsZSBjb252ZW50aW9uLg0KPiANCj4gVGhpcyBpc3N1
ZSB3YXMgZGV0ZWN0ZWQgYnkgdXNpbmcgdGhlIENvY2NpbmVsbGUgc29mdHdhcmUuDQo+IA0KPiBT
aWduZWQtb2ZmLWJ5OiBNYXJrdXMgRWxmcmluZyA8ZWxmcmluZ0B1c2Vycy5zb3VyY2Vmb3JnZS5u
ZXQ+DQoNCkFja2VkLWJ5OiBBZGFtIFRob21zb24gPEFkYW0uVGhvbXNvbi5PcGVuc291cmNlQGRp
YXNlbWkuY29tPg0KDQo+IC0tLQ0KPiAgc291bmQvc29jL2NvZGVjcy9kYTcyMTguYyB8IDMgKy0t
DQo+ICAxIGZpbGUgY2hhbmdlZCwgMSBpbnNlcnRpb24oKyksIDIgZGVsZXRpb25zKC0pDQo+IA0K
PiBkaWZmIC0tZ2l0IGEvc291bmQvc29jL2NvZGVjcy9kYTcyMTguYyBiL3NvdW5kL3NvYy9jb2Rl
Y3MvZGE3MjE4LmMNCj4gaW5kZXggOTNhMGNiNzQxNzUxLi4wYzE5MzNhOTg5OTUgMTAwNjQ0DQo+
IC0tLSBhL3NvdW5kL3NvYy9jb2RlY3MvZGE3MjE4LmMNCj4gKysrIGIvc291bmQvc29jL2NvZGVj
cy9kYTcyMTguYw0KPiBAQCAtMzI2OSw4ICszMjY5LDcgQEAgc3RhdGljIGludCBkYTcyMThfaTJj
X3Byb2JlKHN0cnVjdCBpMmNfY2xpZW50ICppMmMsDQo+ICAJc3RydWN0IGRhNzIxOF9wcml2ICpk
YTcyMTg7DQo+ICAJaW50IHJldDsNCj4gDQo+IC0JZGE3MjE4ID0gZGV2bV9remFsbG9jKCZpMmMt
PmRldiwgc2l6ZW9mKHN0cnVjdCBkYTcyMThfcHJpdiksDQo+IC0JCQkgICAgICBHRlBfS0VSTkVM
KTsNCj4gKwlkYTcyMTggPSBkZXZtX2t6YWxsb2MoJmkyYy0+ZGV2LCBzaXplb2YoKmRhNzIxOCks
IEdGUF9LRVJORUwpOw0KPiAgCWlmICghZGE3MjE4KQ0KPiAgCQlyZXR1cm4gLUVOT01FTTsNCj4g
DQo+IC0tDQo+IDIuMTUuMA0KDQo

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

* Re: [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe()
@ 2017-11-24 11:50     ` Adam Thomson
  0 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 11:50 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

On 23 November 2017 20:08, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:50:44 +0100
> 
> Replace the specification of a data structure by a pointer dereference
> 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>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
>  sound/soc/codecs/da7218.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 93a0cb741751..0c1933a98995 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
>  	struct da7218_priv *da7218;
>  	int ret;
> 
> -	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
> -			      GFP_KERNEL);
> +	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
>  	if (!da7218)
>  		return -ENOMEM;
> 
> --
> 2.15.0

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

* RE: [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
  2017-11-23 20:06   ` SF Markus Elfring
  (?)
@ 2017-11-24 12:03     ` Adam Thomson
  -1 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 12:03 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: LKML, kernel-janitors

On 23 November 2017 20:06, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:48:05 +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>

Hmm. Doesn't really gain an awful lot this. Would understand if there were
multiple return paths, but in that case I'd have implemented something like
this anyway. Also your patch description isn't really correct. You're re-using
code from the sunny day scenario to handle an exception.

> ---
>  sound/soc/codecs/da7218.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 25ab7443d803..93a0cb741751 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -2524,10 +2524,9 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
> 
>  		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
>  					    GFP_KERNEL);
> -		if (!hpldet_pdata) {
> -			of_node_put(hpldet_np);
> -			return pdata;
> -		}
> +		if (!hpldet_pdata)
> +			goto put_node;
> +
>  		pdata->hpldet_pdata = hpldet_pdata;
> 
>  		if (of_property_read_u32(hpldet_np, "dlg,jack-rate-us",
> @@ -2561,6 +2560,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>  		if (of_property_read_bool(hpldet_np, "dlg,discharge"))
>  			hpldet_pdata->discharge = true;
> 
> +put_node:
>  		of_node_put(hpldet_np);
>  	}
> 
> --
> 2.15.0

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

* RE: [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 12:03     ` Adam Thomson
  0 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 12:03 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

T24gMjMgTm92ZW1iZXIgMjAxNyAyMDowNiwgU0YgTWFya3VzIEVsZnJpbmcgd3JvdGU6DQoNCj4g
RnJvbTogTWFya3VzIEVsZnJpbmcgPGVsZnJpbmdAdXNlcnMuc291cmNlZm9yZ2UubmV0Pg0KPiBE
YXRlOiBUaHUsIDIzIE5vdiAyMDE3IDIwOjQ4OjA1ICswMTAwDQo+IA0KPiBBZGQgYSBqdW1wIHRh
cmdldCBzbyB0aGF0IGEgYml0IG9mIGV4Y2VwdGlvbiBoYW5kbGluZyBjYW4gYmUgYmV0dGVyIHJl
dXNlZA0KPiBpbiBhbiBpZiBicmFuY2ggb2YgdGhpcyBmdW5jdGlvbi4NCj4gDQo+IFNpZ25lZC1v
ZmYtYnk6IE1hcmt1cyBFbGZyaW5nIDxlbGZyaW5nQHVzZXJzLnNvdXJjZWZvcmdlLm5ldD4NCg0K
SG1tLiBEb2Vzbid0IHJlYWxseSBnYWluIGFuIGF3ZnVsIGxvdCB0aGlzLiBXb3VsZCB1bmRlcnN0
YW5kIGlmIHRoZXJlIHdlcmUNCm11bHRpcGxlIHJldHVybiBwYXRocywgYnV0IGluIHRoYXQgY2Fz
ZSBJJ2QgaGF2ZSBpbXBsZW1lbnRlZCBzb21ldGhpbmcgbGlrZQ0KdGhpcyBhbnl3YXkuIEFsc28g
eW91ciBwYXRjaCBkZXNjcmlwdGlvbiBpc24ndCByZWFsbHkgY29ycmVjdC4gWW91J3JlIHJlLXVz
aW5nDQpjb2RlIGZyb20gdGhlIHN1bm55IGRheSBzY2VuYXJpbyB0byBoYW5kbGUgYW4gZXhjZXB0
aW9uLg0KDQo+IC0tLQ0KPiAgc291bmQvc29jL2NvZGVjcy9kYTcyMTguYyB8IDggKysrKy0tLS0N
Cj4gIDEgZmlsZSBjaGFuZ2VkLCA0IGluc2VydGlvbnMoKyksIDQgZGVsZXRpb25zKC0pDQo+IA0K
PiBkaWZmIC0tZ2l0IGEvc291bmQvc29jL2NvZGVjcy9kYTcyMTguYyBiL3NvdW5kL3NvYy9jb2Rl
Y3MvZGE3MjE4LmMNCj4gaW5kZXggMjVhYjc0NDNkODAzLi45M2EwY2I3NDE3NTEgMTAwNjQ0DQo+
IC0tLSBhL3NvdW5kL3NvYy9jb2RlY3MvZGE3MjE4LmMNCj4gKysrIGIvc291bmQvc29jL2NvZGVj
cy9kYTcyMTguYw0KPiBAQCAtMjUyNCwxMCArMjUyNCw5IEBAIHN0YXRpYyBzdHJ1Y3QgZGE3MjE4
X3BkYXRhICpkYTcyMThfb2ZfdG9fcGRhdGEoc3RydWN0DQo+IHNuZF9zb2NfY29kZWMgKmNvZGVj
KQ0KPiANCj4gIAkJaHBsZGV0X3BkYXRhID0gZGV2bV9remFsbG9jKGNvZGVjLT5kZXYsIHNpemVv
ZigqaHBsZGV0X3BkYXRhKSwNCj4gIAkJCQkJICAgIEdGUF9LRVJORUwpOw0KPiAtCQlpZiAoIWhw
bGRldF9wZGF0YSkgew0KPiAtCQkJb2Zfbm9kZV9wdXQoaHBsZGV0X25wKTsNCj4gLQkJCXJldHVy
biBwZGF0YTsNCj4gLQkJfQ0KPiArCQlpZiAoIWhwbGRldF9wZGF0YSkNCj4gKwkJCWdvdG8gcHV0
X25vZGU7DQo+ICsNCj4gIAkJcGRhdGEtPmhwbGRldF9wZGF0YSA9IGhwbGRldF9wZGF0YTsNCj4g
DQo+ICAJCWlmIChvZl9wcm9wZXJ0eV9yZWFkX3UzMihocGxkZXRfbnAsICJkbGcsamFjay1yYXRl
LXVzIiwNCj4gQEAgLTI1NjEsNiArMjU2MCw3IEBAIHN0YXRpYyBzdHJ1Y3QgZGE3MjE4X3BkYXRh
ICpkYTcyMThfb2ZfdG9fcGRhdGEoc3RydWN0DQo+IHNuZF9zb2NfY29kZWMgKmNvZGVjKQ0KPiAg
CQlpZiAob2ZfcHJvcGVydHlfcmVhZF9ib29sKGhwbGRldF9ucCwgImRsZyxkaXNjaGFyZ2UiKSkN
Cj4gIAkJCWhwbGRldF9wZGF0YS0+ZGlzY2hhcmdlID0gdHJ1ZTsNCj4gDQo+ICtwdXRfbm9kZToN
Cj4gIAkJb2Zfbm9kZV9wdXQoaHBsZGV0X25wKTsNCj4gIAl9DQo+IA0KPiAtLQ0KPiAyLjE1LjAN
Cg0K

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

* Re: [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 12:03     ` Adam Thomson
  0 siblings, 0 replies; 36+ messages in thread
From: Adam Thomson @ 2017-11-24 12:03 UTC (permalink / raw)
  To: SF Markus Elfring, alsa-devel, Support Opensource, Adam Thomson,
	Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: kernel-janitors, LKML

On 23 November 2017 20:06, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 23 Nov 2017 20:48:05 +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>

Hmm. Doesn't really gain an awful lot this. Would understand if there were
multiple return paths, but in that case I'd have implemented something like
this anyway. Also your patch description isn't really correct. You're re-using
code from the sunny day scenario to handle an exception.

> ---
>  sound/soc/codecs/da7218.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
> index 25ab7443d803..93a0cb741751 100644
> --- a/sound/soc/codecs/da7218.c
> +++ b/sound/soc/codecs/da7218.c
> @@ -2524,10 +2524,9 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
> 
>  		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
>  					    GFP_KERNEL);
> -		if (!hpldet_pdata) {
> -			of_node_put(hpldet_np);
> -			return pdata;
> -		}
> +		if (!hpldet_pdata)
> +			goto put_node;
> +
>  		pdata->hpldet_pdata = hpldet_pdata;
> 
>  		if (of_property_read_u32(hpldet_np, "dlg,jack-rate-us",
> @@ -2561,6 +2560,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct
> snd_soc_codec *codec)
>  		if (of_property_read_bool(hpldet_np, "dlg,discharge"))
>  			hpldet_pdata->discharge = true;
> 
> +put_node:
>  		of_node_put(hpldet_np);
>  	}
> 
> --
> 2.15.0

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

* Re: ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
  2017-11-24 12:03     ` Adam Thomson
  (?)
@ 2017-11-24 12:50       ` SF Markus Elfring
  -1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-24 12:50 UTC (permalink / raw)
  To: Adam Thomson, alsa-devel, support.opensource
  Cc: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai, LKML,
	kernel-janitors

>> Add a jump target so that a bit of exception handling can be better reused
>> in an if branch of this function.
> Hmm. Doesn't really gain an awful lot this.

I show just another small change possibility.


> Would understand if there were multiple return paths,
> but in that case I'd have implemented something like this anyway.

Where?

Can the suggested software refactoring become useful also for this
function implementation?


> Also your patch description isn't really correct.

Which wording would you find more appropriate?


> You're re-using code from the sunny day scenario to handle an exception.

Can this detail be better?

Regards,
Markus

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

* Re: ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 12:50       ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-24 12:50 UTC (permalink / raw)
  To: Adam Thomson, alsa-devel, support.opensource
  Cc: Liam Girdwood, kernel-janitors, LKML, Takashi Iwai, Mark Brown

>> Add a jump target so that a bit of exception handling can be better reused
>> in an if branch of this function.
…
> Hmm. Doesn't really gain an awful lot this.

I show just another small change possibility.


> Would understand if there were multiple return paths,
> but in that case I'd have implemented something like this anyway.

Where?

Can the suggested software refactoring become useful also for this
function implementation?


> Also your patch description isn't really correct.

Which wording would you find more appropriate?


> You're re-using code from the sunny day scenario to handle an exception.

Can this detail be better?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 12:50       ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-24 12:50 UTC (permalink / raw)
  To: Adam Thomson, alsa-devel, support.opensource
  Cc: Liam Girdwood, kernel-janitors, LKML, Takashi Iwai, Mark Brown

>> Add a jump target so that a bit of exception handling can be better reused
>> in an if branch of this function.
> Hmm. Doesn't really gain an awful lot this.

I show just another small change possibility.


> Would understand if there were multiple return paths,
> but in that case I'd have implemented something like this anyway.

Where?

Can the suggested software refactoring become useful also for this
function implementation?


> Also your patch description isn't really correct.

Which wording would you find more appropriate?


> You're re-using code from the sunny day scenario to handle an exception.

Can this detail be better?

Regards,
Markus
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
  2017-11-24 12:03     ` Adam Thomson
  (?)
@ 2017-11-24 12:55       ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-24 12:55 UTC (permalink / raw)
  To: Adam Thomson
  Cc: SF Markus Elfring, alsa-devel, Support Opensource,
	Jaroslav Kysela, Liam Girdwood, Takashi Iwai, LKML,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

On Fri, Nov 24, 2017 at 12:03:32PM +0000, Adam Thomson wrote:
> On 23 November 2017 20:06, SF Markus Elfring wrote:

> > Add a jump target so that a bit of exception handling can be better reused
> > in an if branch of this function.

> Hmm. Doesn't really gain an awful lot this. Would understand if there were
> multiple return paths, but in that case I'd have implemented something like
> this anyway. Also your patch description isn't really correct. You're re-using
> code from the sunny day scenario to handle an exception.

Other people have given him similar feedback on his other patches with
this pattern.  I'm not intending to apply any of them.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 12:55       ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-24 12:55 UTC (permalink / raw)
  To: Adam Thomson
  Cc: alsa-devel, Support Opensource, LKML, Takashi Iwai,
	kernel-janitors, Liam Girdwood, SF Markus Elfring

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

On Fri, Nov 24, 2017 at 12:03:32PM +0000, Adam Thomson wrote:
> On 23 November 2017 20:06, SF Markus Elfring wrote:

> > Add a jump target so that a bit of exception handling can be better reused
> > in an if branch of this function.

> Hmm. Doesn't really gain an awful lot this. Would understand if there were
> multiple return paths, but in that case I'd have implemented something like
> this anyway. Also your patch description isn't really correct. You're re-using
> code from the sunny day scenario to handle an exception.

Other people have given him similar feedback on his other patches with
this pattern.  I'm not intending to apply any of them.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 12:55       ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-24 12:55 UTC (permalink / raw)
  To: Adam Thomson
  Cc: alsa-devel, Support Opensource, LKML, Takashi Iwai,
	kernel-janitors, Liam Girdwood, SF Markus Elfring


[-- Attachment #1.1: Type: text/plain, Size: 657 bytes --]

On Fri, Nov 24, 2017 at 12:03:32PM +0000, Adam Thomson wrote:
> On 23 November 2017 20:06, SF Markus Elfring wrote:

> > Add a jump target so that a bit of exception handling can be better reused
> > in an if branch of this function.

> Hmm. Doesn't really gain an awful lot this. Would understand if there were
> multiple return paths, but in that case I'd have implemented something like
> this anyway. Also your patch description isn't really correct. You're re-using
> code from the sunny day scenario to handle an exception.

Other people have given him similar feedback on his other patches with
this pattern.  I'm not intending to apply any of them.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
  2017-11-24 12:55       ` Mark Brown
  (?)
@ 2017-11-24 13:50         ` SF Markus Elfring
  -1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-24 13:50 UTC (permalink / raw)
  To: Mark Brown, Adam Thomson, alsa-devel, support.opensource
  Cc: Jaroslav Kysela, Liam Girdwood, Takashi Iwai, LKML, kernel-janitors

>>> Add a jump target so that a bit of exception handling can be better reused
>>> in an if branch of this function.
> 
>> Hmm. Doesn't really gain an awful lot this. Would understand if there were
>> multiple return paths, but in that case I'd have implemented something like
>> this anyway. Also your patch description isn't really correct. You're re-using
>> code from the sunny day scenario to handle an exception.
> 
> Other people have given him similar feedback on his other patches with
> this pattern.  I'm not intending to apply any of them.

I can offer another bit of information for a software development discussion. 💭

The affected source file can be compiled for the processor architecture “x86_64”
by a tool like “GCC 6.4.1+r251631-1.3” from the software distribution
“openSUSE Tumbleweed” with the following command example.

my_cc=/usr/bin/gcc-6 \
&& my_module=sound/soc/codecs/da7218.o \
&& for XYZ in 0 s 3; do echo "   _____ $XYZ _____" \
&& my_extra="-O$XYZ" \
&& git checkout ':/^ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}" \
&& git checkout ':/^ASoC: da7218: Use common error handling code in da7218_of_to_pdata' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}"; done


🔮 Do you find the following differences worth for further clarification?

╔═════════╤══════╗
║ setting │ text ║
╠═════════╪══════╣
║   O0    │ -25  ║
║   Os    │ -14  ║
║   O3    │ +11  ║
╚═════════╧══════╝


Regards,
Markus

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

* Re: ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 13:50         ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-24 13:50 UTC (permalink / raw)
  To: Mark Brown, Adam Thomson, alsa-devel, support.opensource
  Cc: LKML, Takashi Iwai, kernel-janitors, Liam Girdwood

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 2021 bytes --]

>>> Add a jump target so that a bit of exception handling can be better reused
>>> in an if branch of this function.
> 
>> Hmm. Doesn't really gain an awful lot this. Would understand if there were
>> multiple return paths, but in that case I'd have implemented something like
>> this anyway. Also your patch description isn't really correct. You're re-using
>> code from the sunny day scenario to handle an exception.
> 
> Other people have given him similar feedback on his other patches with
> this pattern.  I'm not intending to apply any of them.

I can offer another bit of information for a software development discussion. 💭

The affected source file can be compiled for the processor architecture “x86_64”
by a tool like “GCC 6.4.1+r251631-1.3” from the software distribution
“openSUSE Tumbleweed” with the following command example.

my_cc=/usr/bin/gcc-6 \
&& my_module=sound/soc/codecs/da7218.o \
&& for XYZ in 0 s 3; do echo "   _____ $XYZ _____" \
&& my_extra="-O$XYZ" \
&& git checkout ':/^ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}" \
&& git checkout ':/^ASoC: da7218: Use common error handling code in da7218_of_to_pdata' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}"; done


🔮 Do you find the following differences worth for further clarification?

╔═════════╤══════╗
║ setting │ text ║
╠═════════╪══════╣
║   O0    │ -25  ║
║   Os    │ -14  ║
║   O3    │ +11  ║
╚═════════╧══════╝


Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: ASoC: da7218: Use common error handling code in da7218_of_to_pdata()
@ 2017-11-24 13:50         ` SF Markus Elfring
  0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-11-24 13:50 UTC (permalink / raw)
  To: Mark Brown, Adam Thomson, alsa-devel, support.opensource
  Cc: LKML, Takashi Iwai, kernel-janitors, Liam Girdwood

>>> Add a jump target so that a bit of exception handling can be better reused
>>> in an if branch of this function.
> 
>> Hmm. Doesn't really gain an awful lot this. Would understand if there were
>> multiple return paths, but in that case I'd have implemented something like
>> this anyway. Also your patch description isn't really correct. You're re-using
>> code from the sunny day scenario to handle an exception.
> 
> Other people have given him similar feedback on his other patches with
> this pattern.  I'm not intending to apply any of them.

I can offer another bit of information for a software development discussion. 💭

The affected source file can be compiled for the processor architecture “x86_64”
by a tool like “GCC 6.4.1+r251631-1.3” from the software distribution
“openSUSE Tumbleweed” with the following command example.

my_cc=/usr/bin/gcc-6 \
&& my_module=sound/soc/codecs/da7218.o \
&& for XYZ in 0 s 3; do echo "   _____ $XYZ _____" \
&& my_extra="-O$XYZ" \
&& git checkout ':/^ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}" \
&& git checkout ':/^ASoC: da7218: Use common error handling code in da7218_of_to_pdata' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}"; done


🔮 Do you find the following differences worth for further clarification?

╔═════════╤══════╗
║ setting │ text ║
╠═════════╪══════╣
║   O0    │ -25  ║
║   Os    │ -14  ║
║   O3    │ +11  ║
╚═════════╧══════╝


Regards,
Markus
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Applied "ASoC: da7218: Improve a size determination in da7218_i2c_probe()" to the asoc tree
  2017-11-23 20:07   ` SF Markus Elfring
  (?)
@ 2017-11-27 18:53     ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-27 18:53 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Adam Thomson, Mark Brown, alsa-devel, support.opensource,
	Adam Thomson, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Takashi Iwai, kernel-janitors, LKML, alsa-devel

The patch

   ASoC: da7218: Improve a size determination in da7218_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 392b79e20b41cfdc174d31bd4b004bbd874de4d9 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:50:44 +0100
Subject: [PATCH] ASoC: da7218: Improve a size determination in
 da7218_i2c_probe()

Replace the specification of a data structure by a pointer dereference
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>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/da7218.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 25ab7443d803..96c644a15b11 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	struct da7218_priv *da7218;
 	int ret;
 
-	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
-			      GFP_KERNEL);
+	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
 	if (!da7218)
 		return -ENOMEM;
 
-- 
2.15.0

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

* Applied "ASoC: da7218: Improve a size determination in da7218_i2c_probe()" to the asoc tree
@ 2017-11-27 18:53     ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-27 18:53 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Adam Thomson, Mark Brown, alsa-devel, support.opensource

The patch

   ASoC: da7218: Improve a size determination in da7218_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 392b79e20b41cfdc174d31bd4b004bbd874de4d9 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:50:44 +0100
Subject: [PATCH] ASoC: da7218: Improve a size determination in
 da7218_i2c_probe()

Replace the specification of a data structure by a pointer dereference
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>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/da7218.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 25ab7443d803..96c644a15b11 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	struct da7218_priv *da7218;
 	int ret;
 
-	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
-			      GFP_KERNEL);
+	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
 	if (!da7218)
 		return -ENOMEM;
 
-- 
2.15.0


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

* Applied "ASoC: da7218: Improve a size determination in da7218_i2c_probe()" to the asoc tree
@ 2017-11-27 18:53     ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-27 18:53 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Adam Thomson, Mark Brown, alsa-devel, support.opensource

The patch

   ASoC: da7218: Improve a size determination in da7218_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 392b79e20b41cfdc174d31bd4b004bbd874de4d9 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:50:44 +0100
Subject: [PATCH] ASoC: da7218: Improve a size determination in
 da7218_i2c_probe()

Replace the specification of a data structure by a pointer dereference
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>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/da7218.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 25ab7443d803..96c644a15b11 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3269,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	struct da7218_priv *da7218;
 	int ret;
 
-	da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv),
-			      GFP_KERNEL);
+	da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
 	if (!da7218)
 		return -ENOMEM;
 
-- 
2.15.0

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

* Applied "ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()" to the asoc tree
  2017-11-23 20:04   ` [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_p SF Markus Elfring
  (?)
@ 2017-11-27 18:54     ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-27 18:54 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Adam Thomson, Mark Brown, alsa-devel, support.opensource,
	Adam Thomson, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Takashi Iwai, kernel-janitors, LKML, alsa-devel

The patch

   ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_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 14a07f1d8c4c64af29566316df0415052e8bdfe4 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:42:20 +0100
Subject: [PATCH] ASoC: da7218: Delete two error messages for a failed memory
 allocation in da7218_of_to_pdata()

Omit extra messages 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>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/da7218.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 56564ce90cb6..25ab7443d803 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 	u32 of_val32;
 
 	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
 		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
 		if (!hpldet_pdata) {
-			dev_warn(codec->dev,
-				 "Failed to allocate memory for hpldet pdata\n");
 			of_node_put(hpldet_np);
 			return pdata;
 		}
-- 
2.15.0

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

* Applied "ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdat
@ 2017-11-27 18:54     ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-27 18:54 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Adam Thomson, Mark Brown, alsa-devel, support.opensource

The patch

   ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_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 14a07f1d8c4c64af29566316df0415052e8bdfe4 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:42:20 +0100
Subject: [PATCH] ASoC: da7218: Delete two error messages for a failed memory
 allocation in da7218_of_to_pdata()

Omit extra messages 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>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/da7218.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 56564ce90cb6..25ab7443d803 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 	u32 of_val32;
 
 	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
 		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
 		if (!hpldet_pdata) {
-			dev_warn(codec->dev,
-				 "Failed to allocate memory for hpldet pdata\n");
 			of_node_put(hpldet_np);
 			return pdata;
 		}
-- 
2.15.0


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

* Applied "ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()" to the asoc tree
@ 2017-11-27 18:54     ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-11-27 18:54 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Adam Thomson, Mark Brown, alsa-devel, support.opensource

The patch

   ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_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 14a07f1d8c4c64af29566316df0415052e8bdfe4 Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 23 Nov 2017 20:42:20 +0100
Subject: [PATCH] ASoC: da7218: Delete two error messages for a failed memory
 allocation in da7218_of_to_pdata()

Omit extra messages 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>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/da7218.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 56564ce90cb6..25ab7443d803 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 	u32 of_val32;
 
 	pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
 		pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
 		hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
 					    GFP_KERNEL);
 		if (!hpldet_pdata) {
-			dev_warn(codec->dev,
-				 "Failed to allocate memory for hpldet pdata\n");
 			of_node_put(hpldet_np);
 			return pdata;
 		}
-- 
2.15.0

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

end of thread, other threads:[~2017-11-27 18:54 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23 20:03 [PATCH 0/3] ASoC: da7218: Adjustments for two function implementations SF Markus Elfring
2017-11-23 20:03 ` SF Markus Elfring
2017-11-23 20:03 ` SF Markus Elfring
2017-11-23 20:04 ` [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata() SF Markus Elfring
2017-11-23 20:04   ` SF Markus Elfring
2017-11-23 20:04   ` [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_p SF Markus Elfring
2017-11-24 11:44   ` [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata() Adam Thomson
2017-11-24 11:44     ` Adam Thomson
2017-11-24 11:44     ` [PATCH 1/3] ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_ Adam Thomson
2017-11-27 18:54   ` Applied "ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdata()" to the asoc tree Mark Brown
2017-11-27 18:54     ` Mark Brown
2017-11-27 18:54     ` Applied "ASoC: da7218: Delete two error messages for a failed memory allocation in da7218_of_to_pdat Mark Brown
2017-11-23 20:06 ` [PATCH 2/3] ASoC: da7218: Use common error handling code in da7218_of_to_pdata() SF Markus Elfring
2017-11-23 20:06   ` SF Markus Elfring
2017-11-23 20:06   ` SF Markus Elfring
2017-11-24 12:03   ` Adam Thomson
2017-11-24 12:03     ` Adam Thomson
2017-11-24 12:03     ` Adam Thomson
2017-11-24 12:50     ` SF Markus Elfring
2017-11-24 12:50       ` SF Markus Elfring
2017-11-24 12:50       ` SF Markus Elfring
2017-11-24 12:55     ` [PATCH 2/3] " Mark Brown
2017-11-24 12:55       ` Mark Brown
2017-11-24 12:55       ` Mark Brown
2017-11-24 13:50       ` SF Markus Elfring
2017-11-24 13:50         ` SF Markus Elfring
2017-11-24 13:50         ` SF Markus Elfring
2017-11-23 20:07 ` [PATCH 3/3] ASoC: da7218: Improve a size determination in da7218_i2c_probe() SF Markus Elfring
2017-11-23 20:07   ` SF Markus Elfring
2017-11-23 20:07   ` SF Markus Elfring
2017-11-24 11:50   ` Adam Thomson
2017-11-24 11:50     ` Adam Thomson
2017-11-24 11:50     ` Adam Thomson
2017-11-27 18:53   ` Applied "ASoC: da7218: Improve a size determination in da7218_i2c_probe()" to the asoc tree Mark Brown
2017-11-27 18:53     ` Mark Brown
2017-11-27 18:53     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.