All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaobo Liu <cppcoffee@gmail.com>
To: valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, cppcoffee@gmail.com
Subject: [PATCH] usb: usbip: remove unnecessary cmd variable
Date: Fri, 28 Jun 2024 18:46:16 +0800	[thread overview]
Message-ID: <20240628104616.16441-1-cppcoffee@gmail.com> (raw)

There are two redundant if conditions that can be simplified to directly use pdu->u.cmd_submit.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
---
 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;
-- 
2.34.1


             reply	other threads:[~2024-06-28 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 10:46 Xiaobo Liu [this message]
2024-06-28 17:15 ` [PATCH] usb: usbip: remove unnecessary cmd variable Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240628104616.16441-1-cppcoffee@gmail.com \
    --to=cppcoffee@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=i@zenithal.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.