Skip to contentSkip to conversation

staging: rtl8188eu: hal: remove an unneeded variable

PATCH In review Payal Kshirsagar 4 participants 9 messages Mar 11, 2020 – Mar 12, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: rtl8188eu: hal: remove an unneeded variable

Remove unneeded temporary local variable, cleanup suggested by coccinelle.

---
v2: Change in commit message and changelog.

 drivers/staging/rtl8188eu/hal/usb_halinit.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/rtl8188eu/hal/usb_halinit.c +1 -5
index 16a57b31a439..aa6354b9ffa2 100644
@@ -40,8 +40,6 @@ static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe)
 
 static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPipe, u8 NumOutPipe)
 {
-	bool			result		= false;
-
 	_ConfigNormalChipOutEP_8188E(adapt, NumOutPipe);
 
 	/*  Normal chip with one IN and one OUT doesn't have interrupt IN EP. */
@@ -52,9 +50,7 @@ static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPip
 
 	/*  All config other than above support one Bulk IN and one Interrupt IN. */
 
-	result = hal_mapping_out_pipe(adapt, NumOutPipe);
-
-	return result;
+	return hal_mapping_out_pipe(adapt, NumOutPipe);
 }
 
 void rtw_hal_chip_configure(struct adapter *adapt)
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · On Wed, 11 Mar 2020 13:04:18 +0530 Payal Kshirsagar…

Remove unneeded temporary local variable, cleanup suggested by coccinelle.

---
v2: Change in commit message and changelog.

Note, mostly for the future: especially if changes to a patch are not trivial, it's a good practice to attribute suggestions to their authors. If the notes come before "---" (as it's the case for networking changes) that also ends up in the git history.

For example, this could have been:

v2: Change in commit message and changelog (as suggested by Julia
Lawall)

or even:

v2: Change in commit message and changelog (Julia)

Two examples (there might be more complicated ones or different styles, I just could remember and quickly find these):

commit 1e47b4837f3b ("ipv6: Dump route exceptions if requested")
commit 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges")

Anyway, it looks good to me!

Signature · 1 line
Stefano
#2 lore raw
Quoted 15 lines · Stefano Brivio
Quoted 1 line · On Wed, 11 Mar 2020 13:04:18 +0530 Payal Kshirsagar…

Remove unneeded temporary local variable, cleanup suggested by

coccinelle.

Quoted 4 lines

---
v2: Change in commit message and changelog.

Note, mostly for the future: especially if changes to a patch are not trivial, it's a good practice to attribute suggestions to their authors. If the notes come before "---" (as it's the case for networking changes) that also ends up in the git history.

Quoted 9 lines

For example, this could have been:

v2: Change in commit message and changelog (as suggested by Julia
Lawall)

or even:

v2: Change in commit message and changelog (Julia)

Okay, I will take care from next time.

Two examples (there might be more complicated ones or different styles,

Quoted 14 lines

I just could remember and quickly find these):

commit 1e47b4837f3b ("ipv6: Dump route exceptions if requested") commit 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges")

Anyway, it looks good to me!

--
Stefano

maintainer
#3 lore raw
In reply to Payal Kshirsagar
Quoted 36 lines · Payal Kshirsagar

Remove unneeded temporary local variable, cleanup suggested by coccinelle.

---
v2: Change in commit message and changelog.

 drivers/staging/rtl8188eu/hal/usb_halinit.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/rtl8188eu/hal/usb_halinit.c +1 -5
index 16a57b31a439..aa6354b9ffa2 100644
@@ -40,8 +40,6 @@ static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe)
 
 static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPipe, u8 NumOutPipe)
 {
-	bool			result		= false;
-
 	_ConfigNormalChipOutEP_8188E(adapt, NumOutPipe);
 
 	/*  Normal chip with one IN and one OUT doesn't have interrupt IN EP. */
@@ -52,9 +50,7 @@ static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPip
 
 	/*  All config other than above support one Bulk IN and one Interrupt IN. */
 
-	result = hal_mapping_out_pipe(adapt, NumOutPipe);
-
-	return result;
+	return hal_mapping_out_pipe(adapt, NumOutPipe);
 }
 
 void rtw_hal_chip_configure(struct adapter *adapt)
Signature · 1 line
2.17.1

Always test-build your patches so that you do not get grumpy kernel maintainers telling you to test-build your patches to prevent the build from breaking.

Are you _SURE_ you used coccinelle for this? If so, something is really broken as this patch is totally incorrect :(

The suggestion might be correct, but the implementation is broken.

thanks,

greg k-h

#4 lore raw
Quoted 41 lines · Greg KH
Quoted 40 lines · Payal Kshirsagar

Remove unneeded temporary local variable, cleanup suggested by coccinelle.

---
v2: Change in commit message and changelog.

 drivers/staging/rtl8188eu/hal/usb_halinit.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/rtl8188eu/hal/usb_halinit.c +0 -2
index 16a57b31a439..aa6354b9ffa2 100644
@@ -40,8 +40,6 @@ static void _ConfigNormalChipOutEP_8188E(struct
 adapter *adapt, u8 NumOutPipe)
 
 static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter
 *adapt, u8 NumInPipe, u8 NumOutPipe)
 {
-	bool			result		= false;
-
 	_ConfigNormalChipOutEP_8188E(adapt, NumOutPipe);

/* Normal chip with one IN and one OUT doesn't have interrupt
IN EP. */

drivers/staging/rtl8188eu/hal/usb_halinit.c +0 -0
@@ -52,9 +50,7 @@ static bool

HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPip

/* All config other than above support one Bulk IN and one
Interrupt IN. */

drivers/staging/rtl8188eu/hal/usb_halinit.c +1 -3
-	result = hal_mapping_out_pipe(adapt, NumOutPipe);
-
-	return result;
+	return hal_mapping_out_pipe(adapt, NumOutPipe);
 }
Quoted 10 lines
Quoted 4 lines

void rtw_hal_chip_configure(struct adapter *adapt)

Signature · 1 line
2.17.1

Always test-build your patches so that you do not get grumpy kernel maintainers telling you to test-build your patches to prevent the build
from breaking.

HOW TO test-build the patches?

Quoted 9 lines

Are you _SURE_ you used coccinelle for this? If so, something is really
broken as this patch is totally incorrect :(

The suggestion might be correct, but the implementation is broken.

thanks,

greg k-h

Yes, I used following semantic patch to get this file for cleanup @@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;

#5 lore raw
Quoted 7 lines
Quoted 5 lines

Always test-build your patches so that you do not get grumpy kernel maintainers telling you to test-build your patches to prevent the build
from breaking.

HOW TO test-build the patches?

Compile the code and be sure you obtain a .o file for the file you changed. If you don't you may need to adjust the configuration variables.

Quoted 18 lines
Quoted 11 lines

Are you _SURE_ you used coccinelle for this? If so, something is really
broken as this patch is totally incorrect :(

The suggestion might be correct, but the implementation is broken.

thanks,

greg k-h

Yes, I used following semantic patch to get this file for cleanup @@
local idexpression ret;
expression e;
@@

Review

Quoted 4 lines
(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

The semantic patch is fine, but you also deleted the variable declaration. If you use a tool, it is best to make clear how you used it and what you did beyond what the tool said to do.

julia

Quoted 5 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/13eb3ca2d7db751231b3a755e1609e385ce3c36a.camel%40gmail.com.

#6 lore raw
Quoted 33 lines · Julia Lawall
Quoted 8 lines
Quoted 6 lines

Always test-build your patches so that you do not get grumpy kernel
maintainers telling you to test-build your patches to prevent the build
from breaking.

HOW TO test-build the patches?

Compile the code and be sure you obtain a .o file for the file you changed. If you don't you may need to adjust the configuration variables.

Quoted 19 lines
Quoted 6 lines

Are you _SURE_ you used coccinelle for this? If so, something is really
broken as this patch is totally incorrect :(

Quoted 6 lines

The suggestion might be correct, but the implementation is broken.

thanks,

greg k-h

Yes, I used following semantic patch to get this file for cleanup @@
local idexpression ret;
expression e;
@@

Quoted 11 lines

Review

Quoted 4 lines
(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;

The semantic patch is fine, but you also deleted the variable declaration.
If you use a tool, it is best to make clear how you used it and what you
did beyond what the tool said to do.

I deleted the declaration because it will be of no use if I delete other two lines which is the only use of that variable.
I am Extremly sorry, but I am not understanding what need to be done.

Quoted 12 lines

julia

Quoted 9 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/13eb3ca2d7db751231b3a755e1609e385ce3c36a.camel%40gmail.com
.

#7 lore raw
Quoted 4 lines

I deleted the declaration because it will be of no use if I delete other two lines which is the only use of that variable.
I am Extremly sorry, but I am not understanding what need to be done.

As far as I could see there was another use of the variable in an if branch. Those can be easy to overlook. Just be sure that you get a .o file after compiling the code that you changed and you should be mostly ok.

julia

#8 lore raw
Quoted 10 lines · Julia Lawall
Quoted 4 lines

I deleted the declaration because it will be of no use if I delete other two lines which is the only use of that variable.
I am Extremly sorry, but I am not understanding what need to be done.

As far as I could see there was another use of the variable in an if branch. Those can be easy to overlook. Just be sure that you get a .o file after compiling the code that you changed and you should be mostly ok.

Okay, Thank You:)

Quoted 1 line

julia