public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Xiaobo Liu <cppcoffee@gmail.com>,
	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,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] usb: usbip: remove unnecessary cmd variable
Date: Fri, 28 Jun 2024 11:15:28 -0600	[thread overview]
Message-ID: <8c94fa65-780e-44d2-8e75-5cdc51cee9f6@linuxfoundation.org> (raw)
In-Reply-To: <20240628104616.16441-1-cppcoffee@gmail.com>

On 6/28/24 04:46, Xiaobo Liu wrote:
> There are two redundant if conditions that can be simplified to directly use pdu->u.cmd_submit.
> 

I see you sent the same patch twice without indicating that it is a
resend with a change in subject line.

How did you determine this change is necessary?

> 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);

Did you check what correct_endian_basic() does and why
it is important to check "send" and assign "cmd"

>   
> -	if (!send)
> -		cmd = pdu->base.command;

It is necessary to assign the command after calling
> -
> -	switch (cmd) {
> +	switch (pdu->base.command) {
>   	case USBIP_CMD_SUBMIT:
>   		correct_endian_cmd_submit(&pdu->u.cmd_submit, send);
>   		break;

This patch will introduce an error. NAK on this patch.

thanks,
-- Shuah

      reply	other threads:[~2024-06-28 17:15 UTC|newest]

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

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=8c94fa65-780e-44d2-8e75-5cdc51cee9f6@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox