linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions
@ 2017-04-26 15:33 SF Markus Elfring
  2017-04-26 15:34 ` [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-26 15:33 UTC (permalink / raw)
  To: linux-pm, linux-omap, Eduardo Valentin, Keerthy, Zhang Rui
  Cc: LKML, kernel-janitors

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

-- 
2.12.2

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

* [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build()
  2017-04-26 15:33 [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions SF Markus Elfring
@ 2017-04-26 15:34 ` SF Markus Elfring
  2017-05-02  3:55   ` Keerthy
  2017-04-26 15:37 ` [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations " SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-26 15:34 UTC (permalink / raw)
  To: linux-pm, linux-omap, Eduardo Valentin, Keerthy, Zhang Rui
  Cc: LKML, kernel-janitors

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index ba9c302454fb..f19cb7612a65 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -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);
-- 
2.12.2

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

* [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations in ti_bandgap_build()
  2017-04-26 15:33 [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions SF Markus Elfring
  2017-04-26 15:34 ` [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() SF Markus Elfring
@ 2017-04-26 15:37 ` SF Markus Elfring
  2017-05-02  3:52   ` Keerthy
  2017-04-26 15:39 ` [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line SF Markus Elfring
  2017-04-27 16:20 ` [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions Eduardo Valentin
  3 siblings, 1 reply; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-26 15:37 UTC (permalink / raw)
  To: linux-pm, linux-omap, Eduardo Valentin, Keerthy, Zhang Rui
  Cc: LKML, kernel-janitors, Wolfram Sang

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

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index f19cb7612a65..109fb0a5f19f 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -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 {
-- 
2.12.2

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

* [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line
  2017-04-26 15:33 [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions SF Markus Elfring
  2017-04-26 15:34 ` [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() SF Markus Elfring
  2017-04-26 15:37 ` [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations " SF Markus Elfring
@ 2017-04-26 15:39 ` SF Markus Elfring
  2017-05-02  3:51   ` Keerthy
  2017-04-27 16:20 ` [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions Eduardo Valentin
  3 siblings, 1 reply; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-26 15:39 UTC (permalink / raw)
  To: linux-pm, linux-omap, Eduardo Valentin, Keerthy, Zhang Rui
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 26 Apr 2017 17:11:28 +0200

Add a missing character in this description for a function.

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

diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index 109fb0a5f19f..696ab3046b87 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -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
-- 
2.12.2

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

* Re: [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions
  2017-04-26 15:33 [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-04-26 15:39 ` [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line SF Markus Elfring
@ 2017-04-27 16:20 ` Eduardo Valentin
  2017-05-01  5:20   ` Keerthy
  3 siblings, 1 reply; 10+ messages in thread
From: Eduardo Valentin @ 2017-04-27 16:20 UTC (permalink / raw)
  To: SF Markus Elfring, Keerthy
  Cc: linux-pm, linux-omap, Zhang Rui, LKML, kernel-janitors

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

On Wed, Apr 26, 2017 at 05:33:10PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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,

>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> -- 
> 2.12.2
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions
  2017-04-27 16:20 ` [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions Eduardo Valentin
@ 2017-05-01  5:20   ` Keerthy
  2017-05-02  4:55     ` Keerthy
  0 siblings, 1 reply; 10+ messages in thread
From: Keerthy @ 2017-05-01  5:20 UTC (permalink / raw)
  To: Eduardo Valentin, SF Markus Elfring
  Cc: linux-pm, linux-omap, Zhang Rui, LKML, kernel-janitors



On Thursday 27 April 2017 09:50 PM, Eduardo Valentin wrote:
> On Wed, Apr 26, 2017 at 05:33:10PM +0200, SF Markus Elfring wrote:
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> 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.

Sure Eduardo. I will test and review this series.

> 
> BR,
> 
>>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
>>  1 file changed, 5 insertions(+), 9 deletions(-)
>>
>> -- 
>> 2.12.2
>>

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

* Re: [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line
  2017-04-26 15:39 ` [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line SF Markus Elfring
@ 2017-05-02  3:51   ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2017-05-02  3:51 UTC (permalink / raw)
  To: SF Markus Elfring, linux-pm, linux-omap, Eduardo Valentin, Zhang Rui
  Cc: LKML, kernel-janitors



On Wednesday 26 April 2017 09:09 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 26 Apr 2017 17:11:28 +0200
> 
> Add a missing character in this description for a function.

Reviewed-by: Keerthy <j-keerthy@ti.com>

> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> index 109fb0a5f19f..696ab3046b87 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> @@ -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
> 

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

* Re: [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations in ti_bandgap_build()
  2017-04-26 15:37 ` [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations " SF Markus Elfring
@ 2017-05-02  3:52   ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2017-05-02  3:52 UTC (permalink / raw)
  To: SF Markus Elfring, linux-pm, linux-omap, Eduardo Valentin, Zhang Rui
  Cc: LKML, kernel-janitors, Wolfram Sang



On Wednesday 26 April 2017 09:07 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.

Reviewed-by: Keerthy <j-keerthy@ti.com>

> 
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> index f19cb7612a65..109fb0a5f19f 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> @@ -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 {
> 

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

* Re: [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build()
  2017-04-26 15:34 ` [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() SF Markus Elfring
@ 2017-05-02  3:55   ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2017-05-02  3:55 UTC (permalink / raw)
  To: SF Markus Elfring, linux-pm, linux-omap, Eduardo Valentin, Zhang Rui
  Cc: LKML, kernel-janitors



On Wednesday 26 April 2017 09:04 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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".

Reviewed-by: Keerthy <j-keerthy@ti.com>

> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> index ba9c302454fb..f19cb7612a65 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> @@ -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);
> 

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

* Re: [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions
  2017-05-01  5:20   ` Keerthy
@ 2017-05-02  4:55     ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2017-05-02  4:55 UTC (permalink / raw)
  To: Eduardo Valentin, SF Markus Elfring
  Cc: linux-pm, linux-omap, Zhang Rui, LKML, kernel-janitors



On Monday 01 May 2017 10:50 AM, Keerthy wrote:
> 
> 
> On Thursday 27 April 2017 09:50 PM, Eduardo Valentin wrote:
>> On Wed, Apr 26, 2017 at 05:33:10PM +0200, SF Markus Elfring wrote:
>>> From: Markus Elfring <elfring@users.sourceforge.net>
>>> 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.
> 
> 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:

Acked-by: Keerthy <j-keerthy@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>

- Keerthy

> 
>>
>> BR,
>>
>>>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 14 +++++---------
>>>  1 file changed, 5 insertions(+), 9 deletions(-)
>>>
>>> -- 
>>> 2.12.2
>>>

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

end of thread, other threads:[~2017-05-02  4:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26 15:33 [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions SF Markus Elfring
2017-04-26 15:34 ` [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() SF Markus Elfring
2017-05-02  3:55   ` Keerthy
2017-04-26 15:37 ` [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations " SF Markus Elfring
2017-05-02  3:52   ` Keerthy
2017-04-26 15:39 ` [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line SF Markus Elfring
2017-05-02  3:51   ` Keerthy
2017-04-27 16:20 ` [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions Eduardo Valentin
2017-05-01  5:20   ` Keerthy
2017-05-02  4:55     ` Keerthy

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