diff mbox

thermal/intel_powerclamp: pr_err()/pr_info() strings should end with newlines

Message ID 277b8d12fc6980ec2ffd039a872f681ec0e49c19.1507549738.git.arvind.yadav.cs@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Zhang Rui
Headers show

Commit Message

Arvind Yadav Oct. 9, 2017, 11:51 a.m. UTC
pr_err()/pr_info() messages should end with a new-line to avoid
other messages being concatenated.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/thermal/intel_powerclamp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Lezcano Oct. 9, 2017, 12:33 p.m. UTC | #1
On 09/10/2017 13:51, Arvind Yadav wrote:
> pr_err()/pr_info() messages should end with a new-line to avoid
> other messages being concatenated.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/thermal/intel_powerclamp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
> index d718cd1..4540e89 100644
> --- a/drivers/thermal/intel_powerclamp.c
> +++ b/drivers/thermal/intel_powerclamp.c
> @@ -675,13 +675,13 @@ static int __init powerclamp_probe(void)
>  {
>  
>  	if (!x86_match_cpu(intel_powerclamp_ids)) {
> -		pr_err("CPU does not support MWAIT");
> +		pr_err("CPU does not support MWAIT\n");
>  		return -ENODEV;
>  	}
>  
>  	/* The goal for idle time alignment is to achieve package cstate. */
>  	if (!has_pkg_state_counter()) {
> -		pr_info("No package C-state available");
> +		pr_info("No package C-state available\n");
>  		return -ENODEV;
>  	}


Hi Arvind,

you are sending these fixes for all the drivers around. There is a way
to fix this once and for all: use the coccinelle tools [1], add the
script in the changelog with a big patchset and add the script in the
coccinelle scripts directory [2].

  -- Daniel

[1] Documentation/dev-tools/coccinelle.rst
[2] scripts/coccinelle/misc
Joe Perches Oct. 10, 2017, 4:37 a.m. UTC | #2
On Mon, 2017-10-09 at 14:33 +0200, Daniel Lezcano wrote:
> On 09/10/2017 13:51, Arvind Yadav wrote:
> > pr_err()/pr_info() messages should end with a new-line to avoid
> > other messages being concatenated.
[]
> > diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
> > @@ -675,13 +675,13 @@ static int __init powerclamp_probe(void)
> >  {
> >  
> >  	if (!x86_match_cpu(intel_powerclamp_ids)) {
> > -		pr_err("CPU does not support MWAIT");
> > +		pr_err("CPU does not support MWAIT\n");

[etc...]

> Hi Arvind,
> 
> you are sending these fixes for all the drivers around. There is a way
> to fix this once and for all: use the coccinelle tools [1], add the
> script in the changelog with a big patchset and add the script in the
> coccinelle scripts directory [2].

That can't work as any printk without a newline termination
could be followed by a printk(KERN_CONT/pr_cont( in another
function.

All of these must be hand-verified.
Daniel Lezcano Oct. 10, 2017, 8:24 a.m. UTC | #3
On 10/10/2017 06:37, Joe Perches wrote:
> On Mon, 2017-10-09 at 14:33 +0200, Daniel Lezcano wrote:
>> On 09/10/2017 13:51, Arvind Yadav wrote:
>>> pr_err()/pr_info() messages should end with a new-line to avoid
>>> other messages being concatenated.
> []
>>> diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
>>> @@ -675,13 +675,13 @@ static int __init powerclamp_probe(void)
>>>  {
>>>  
>>>  	if (!x86_match_cpu(intel_powerclamp_ids)) {
>>> -		pr_err("CPU does not support MWAIT");
>>> +		pr_err("CPU does not support MWAIT\n");
> 
> [etc...]
> 
>> Hi Arvind,
>>
>> you are sending these fixes for all the drivers around. There is a way
>> to fix this once and for all: use the coccinelle tools [1], add the
>> script in the changelog with a big patchset and add the script in the
>> coccinelle scripts directory [2].
> 
> That can't work as any printk without a newline termination
> could be followed by a printk(KERN_CONT/pr_cont( in another
> function.
> 
> All of these must be hand-verified.

Ouch!

Fair enough. Thanks for the info.

  -- Daniel
diff mbox

Patch

diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
index d718cd1..4540e89 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -675,13 +675,13 @@  static int __init powerclamp_probe(void)
 {
 
 	if (!x86_match_cpu(intel_powerclamp_ids)) {
-		pr_err("CPU does not support MWAIT");
+		pr_err("CPU does not support MWAIT\n");
 		return -ENODEV;
 	}
 
 	/* The goal for idle time alignment is to achieve package cstate. */
 	if (!has_pkg_state_counter()) {
-		pr_info("No package C-state available");
+		pr_info("No package C-state available\n");
 		return -ENODEV;
 	}