diff mbox series

usb/usbip: remove unnecessary code

Message ID 20240625051321.63761-1-cppcoffee@gmail.com (mailing list archive)
State New
Headers show
Series usb/usbip: remove unnecessary code | expand

Commit Message

Xiaobo Liu June 25, 2024, 5:13 a.m. UTC
Both if branches assign a value to the `cmd` variable.
We can remove the cmd variable and use `pdu->base.command` directly.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
---
 drivers/usb/usbip/usbip_common.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Shuah Khan June 28, 2024, 5:16 p.m. UTC | #1
On 6/24/24 23:13, Xiaobo Liu wrote:
> Both if branches assign a value to the `cmd` variable.
> We can remove the cmd variable and use `pdu->base.command` directly.
> 
> Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>

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

> ---
>   drivers/usb/usbip/usbip_common.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/usbip/usbip_common.c b/drivers/usb/usbip/usbip_common.c
> index a2b2da125..74a01a265 100644
> --- a/drivers/usb/usbip/usbip_common.c
> +++ b/drivers/usb/usbip/usbip_common.c
> @@ -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;

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/drivers/usb/usbip/usbip_common.c b/drivers/usb/usbip/usbip_common.c
index a2b2da125..74a01a265 100644
--- a/drivers/usb/usbip/usbip_common.c
+++ b/drivers/usb/usbip/usbip_common.c
@@ -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;