Skip to contentSkip to conversation

usb/usbip: remove unnecessary code

PATCH In review Xiaobo Liu 2 participants 2 messages Jun 25, 2024 – Jun 28, 2024

Subsystems (2)
lore
Share & tools
lore

Xiaobo Liu

author
#0 lore raw

PATCH 1/1 usb/usbip: remove unnecessary code

Both if branches assign a value to the cmd variable.
We can remove the cmd variable and use pdu->base.command directly.

---
 drivers/usb/usbip/usbip_common.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/usb/usbip/usbip_common.c +1 -9
index a2b2da125..74a01a265 100644
@@ -568,17 +568,9 @@ static void correct_endian_ret_unlink(struct usbip_header_ret_unlink *pdu,
 
 void usbip_header_correct_endian(struct usbip_header *pdu, int send)
 {
-	__u32 cmd = 0;
-
-	if (send)
-		cmd = pdu->base.command;
-
 	correct_endian_basic(&pdu->base, send);
 
-	if (!send)
-		cmd = pdu->base.command;
-
-	switch (cmd) {
+	switch (pdu->base.command) {
 	case USBIP_CMD_SUBMIT:
 		correct_endian_cmd_submit(&pdu->u.cmd_submit, send);
 		break;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 4 lines · Xiaobo Liu

Both if branches assign a value to the cmd variable.
We can remove the cmd variable and use pdu->base.command directly.

This is a duplicate patch and same comments and NAK on this patch.

Quoted 17 lines
---
  drivers/usb/usbip/usbip_common.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
drivers/usb/usbip/usbip_common.c +0 -5
index a2b2da125..74a01a265 100644
@@ -568,17 +568,9 @@ static void correct_endian_ret_unlink(struct usbip_header_ret_unlink *pdu,
 
  void usbip_header_correct_endian(struct usbip_header *pdu, int send)
  {
-	__u32 cmd = 0;
-
-	if (send)
-		cmd = pdu->base.command;
-

drivers/usb/usbip/usbip_common.c static void correct_endian_ret_unlink(struct usbip_header_ret_unlink *pdu, · line 576

Quoted 10 lines
drivers/usb/usbip/usbip_common.c +1 -4
  	correct_endian_basic(&pdu->base, send);
 
-	if (!send)
-		cmd = pdu->base.command;
-
-	switch (cmd) {
+	switch (pdu->base.command) {
  	case USBIP_CMD_SUBMIT:
  		correct_endian_cmd_submit(&pdu->u.cmd_submit, send);
  		break;

thanks,
-- Shuah