Skip to contentSkip to conversation

Staging: speakup: buffers: Fixed a return value coding style issue.

PATCH In review Reza Snowdon 3 participants 5 messages Feb 27, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: speakup: buffers: Fixed a return value coding style issue.

Fixed a coding style issue.

---
 drivers/staging/speakup/buffers.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/buffers.c +2 -1
index 382973e..8d7caa7 100644
@@ -55,7 +55,8 @@ static int synth_buffer_free(void)
 
 int synth_buffer_empty(void)
 {
-	return (buff_in == buff_out);
+	int buff_comparison = (buff_in == buff_out);
+	return buff_comparison;
 }
 EXPORT_SYMBOL_GPL(synth_buffer_empty);
 
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 12 lines · Reza Snowdon

Fixed a coding style issue.

---
 drivers/staging/speakup/buffers.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/buffers.c +0 -0
index 382973e..8d7caa7 100644

drivers/staging/speakup/buffers.c static int synth_buffer_free(void) · line 59

Quoted 6 lines
drivers/staging/speakup/buffers.c +2 -1
@@ -55,7 +55,8 @@ static int synth_buffer_free(void)
 
 int synth_buffer_empty(void)
 {
-	return (buff_in == buff_out);
+	int buff_comparison = (buff_in == buff_out);
+	return buff_comparison;

What's wrong with the original code here? If anything, just drop the (), but really, it's fine, leave it alone, it's obvious what is happening is ok.

thanks,

greg k-h

#2 lore raw

When checking buffers.c with checkpatch.pl it throws the following error: drivers/staging/speakup/buffers.c:58: ERROR: return is not a function, parentheses are not required

I watched one of your talks, it's very informative and concise: http://www.youtube.com/watch?v=LLBrBBImJt4&feature=youtu.be

Thanks,
Reza Snowdon

Quoted 28 lines · Greg KH
Quoted 12 lines · Reza Snowdon

Fixed a coding style issue.

---
  drivers/staging/speakup/buffers.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/buffers.c +0 -0
index 382973e..8d7caa7 100644

drivers/staging/speakup/buffers.c static int synth_buffer_free(void) · line 59

Quoted 6 lines
drivers/staging/speakup/buffers.c +2 -1
@@ -55,7 +55,8 @@ static int synth_buffer_free(void)
 
  int synth_buffer_empty(void)
  {
-	return (buff_in == buff_out);
+	int buff_comparison = (buff_in == buff_out);
+	return buff_comparison;

What's wrong with the original code here? If anything, just drop the (), but really, it's fine, leave it alone, it's obvious what is happening is ok.

thanks,

greg k-h

Signature · 2 lines
Regards,
Reza Snowdon
Quoted 1 line

From a2dda399463c20f63306e31b743e0c9c3be2ca3a Mon Sep 17 00:00:00 2001

From: Reza Snowdon <[email protected]>
Date: Thu, 27 Feb 2014 17:57:59 +0000
Subject: [PATCH] Staging: speakup: buffers: Fixed a return coding style issue

When checking buffers.c with checkpatch.pl it throws the following error: drivers/staging/speakup/buffers.c:58: ERROR: return is not a function, parentheses are not required

Fixed error by removing parenthesis.

---
 drivers/staging/speakup/buffers.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/buffers.c +1 -1
index 382973e..5e6ec13 100644
@@ -55,7 +55,7 @@ static int synth_buffer_free(void)
 
 int synth_buffer_empty(void)
 {
-	return (buff_in == buff_out);
+	return buff_in == buff_out;
 }
 EXPORT_SYMBOL_GPL(synth_buffer_empty);
 
Signature · 1 line
1.7.10.4
maintainer
#3 lore raw
Quoted 3 lines · On Thu, Feb 27, 2014 at 06:12:48PM +0000, [email protected] wrote:

When checking buffers.c with checkpatch.pl it throws the following error:
drivers/staging/speakup/buffers.c:58: ERROR: return is not a function, parentheses are not required

Remember, checkpatch.pl is a "guide", not the "law". Use common sense when using the tool please.

thanks,

greg k-h

#4 lore raw
In reply to Reza Snowdon
Quoted 12 lines · Reza Snowdon

Fixed a coding style issue.

---
 drivers/staging/speakup/buffers.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/buffers.c +0 -0
index 382973e..8d7caa7 100644

drivers/staging/speakup/buffers.c static int synth_buffer_free(void) · line 59

Quoted 6 lines
drivers/staging/speakup/buffers.c +2 -1
@@ -55,7 +55,8 @@ static int synth_buffer_free(void)
 
 int synth_buffer_empty(void)
 {
-	return (buff_in == buff_out);
+	int buff_comparison = (buff_in == buff_out);
+	return buff_comparison;

This isn't simpler than the original code.

Just do:

int synth_buffer_empty(void)

{
	return buff_in == buff_out;
}

regards,
dan carpenter