Skip to contentSkip to conversation

TI-SoC-thermal: Fine-tuning for two functions

PATCH In review SF Markus Elfring 3 participants 10 messages Apr 26, 2017 – May 2, 2017

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

cover TI-SoC-thermal: Fine-tuning for two functions

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:24:56 +0200

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

Markus Elfring (3):
Use devm_kcalloc() in ti_bandgap_build()
Delete error messages for failed memory allocations in ti_bandgap_build() Fix a typo in a comment line

 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.12.2
#1 lore raw

PATCH 1/3 ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build()

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 16:45:25 +0200

A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc".

This issue was detected by using the Coccinelle software.

---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -2
index ba9c302454fb..f19cb7612a65 100644
@@ -1224,8 +1224,8 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
 		bgp->conf = of_id->data;
 
 	/* register shadow for context save and restore */
-	bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
-				   bgp->conf->sensor_count, GFP_KERNEL);
+	bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,
+				   sizeof(*bgp->regval), GFP_KERNEL);
 	if (!bgp->regval) {
 		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
 		return ERR_PTR(-ENOMEM);
Signature · 1 line
2.12.2
#3 lore raw

PATCH 2/3 ti-soc-thermal: Delete error messages for failed memory allocations in ti_bandgap_build()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:03:07 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -6
index f19cb7612a65..109fb0a5f19f 100644
@@ -1217,7 +1217,5 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
-	if (!bgp) {
-		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
+	if (!bgp)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	of_id = of_match_device(of_ti_bandgap_match, &pdev->dev);
 	if (of_id)
@@ -1229,7 +1227,5 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
-	if (!bgp->regval) {
-		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
+	if (!bgp->regval)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	i = 0;
 	do {
Signature · 1 line
2.12.2
#5 lore raw

PATCH 3/3 ti-soc-thermal: Fix a typo in a comment line

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:11:28 +0200

Add a missing character in this description for a function.

---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +1 -1
index 109fb0a5f19f..696ab3046b87 100644
@@ -1010,7 +1010,7 @@ ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
 }
 
 /**
- * ti_bandgap_set_continous_mode() - One time enabling of continuous mode
+ * ti_bandgap_set_continuous_mode() - One time enabling of continuous mode
  * @bgp: pointer to struct ti_bandgap
  *
  * Call this function only if HAS(MODE_CONFIG) is set. As this driver may
Signature · 1 line
2.12.2
maintainer
#7 lore raw
In reply to SF Markus Elfring
Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:24:56 +0200

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

Markus Elfring (3):
Use devm_kcalloc() in ti_bandgap_build()
Delete error messages for failed memory allocations in ti_bandgap_build() Fix a typo in a comment line

Keerthy,

Can you please give it a shot of this series on all supported OMAP chip boards? I do not see any major issue with the series at all, but would like to get it tested by you.

BR,

Quoted 6 lines
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.12.2
maintainer
#8 lore raw
Quoted 13 lines · Eduardo Valentin
Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:24:56 +0200

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

Markus Elfring (3):
Use devm_kcalloc() in ti_bandgap_build()
Delete error messages for failed memory allocations in ti_bandgap_build() Fix a typo in a comment line

Quoted 5 lines

Keerthy,

Can you please give it a shot of this series on all supported OMAP chip boards? I do not see any major issue with the series at all, but would like to get it tested by you.

Sure Eduardo. I will test and review this series.

Quoted 9 lines

BR,

Quoted 6 lines
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.12.2
maintainer Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line

In reply to SF Markus Elfring
Quoted 4 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:11:28 +0200

Add a missing character in this description for a function.

Quoted 20 lines
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +1 -1
index 109fb0a5f19f..696ab3046b87 100644
@@ -1010,7 +1010,7 @@ ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
 }
 
 /**
- * ti_bandgap_set_continous_mode() - One time enabling of continuous mode
+ * ti_bandgap_set_continuous_mode() - One time enabling of continuous mode
  * @bgp: pointer to struct ti_bandgap
  *
  * Call this function only if HAS(MODE_CONFIG) is set. As this driver may
maintainer Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations in ti_bandgap_build()

In reply to SF Markus Elfring
Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:03:07 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

Quoted 30 lines
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -6
index f19cb7612a65..109fb0a5f19f 100644
@@ -1217,7 +1217,5 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
-	if (!bgp) {
-		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
+	if (!bgp)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	of_id = of_match_device(of_ti_bandgap_match, &pdev->dev);
 	if (of_id)
@@ -1229,7 +1227,5 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
-	if (!bgp->regval) {
-		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
+	if (!bgp->regval)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	i = 0;
 	do {
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build()

In reply to SF Markus Elfring
Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 16:45:25 +0200

A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc".

Quoted 24 lines

This issue was detected by using the Coccinelle software.

---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -2
index ba9c302454fb..f19cb7612a65 100644
@@ -1224,8 +1224,8 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
 		bgp->conf = of_id->data;
 
 	/* register shadow for context save and restore */
-	bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
-				   bgp->conf->sensor_count, GFP_KERNEL);
+	bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,
+				   sizeof(*bgp->regval), GFP_KERNEL);
 	if (!bgp->regval) {
 		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
 		return ERR_PTR(-ENOMEM);
maintainer Acked-by Tested-by
#9 lore raw
In reply to Keerthy
Quoted 16 lines · Keerthy
Quoted 13 lines · Eduardo Valentin
Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 17:24:56 +0200

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

Markus Elfring (3):
Use devm_kcalloc() in ti_bandgap_build()
Delete error messages for failed memory allocations in ti_bandgap_build() Fix a typo in a comment line

Quoted 7 lines
Quoted 5 lines

Keerthy,

Can you please give it a shot of this series on all supported OMAP chip boards? I do not see any major issue with the series at all, but would like to get it tested by you.

Sure Eduardo. I will test and review this series.

Tested for Temperatures of all the sensors and thermal shutdown triggering using emul_temp on DRA7/DRA72 AM57xx-evm boards.

For the series:

- Keerthy

Quoted 10 lines
Quoted 10 lines

BR,

Quoted 6 lines
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.12.2