public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Trevor Pace <tr212206@DAL.CA>
Cc: gregkh@suse.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Removed useless retval variables in usb-serial.c
Date: Fri, 24 Jul 2009 20:29:24 +0400	[thread overview]
Message-ID: <4A69E164.9040403@ru.mvista.com> (raw)
In-Reply-To: <20090724124803.ltfbg57ooyoko0gs@my5.dal.ca>

Hello.

Trevor Pace wrote:

> Removed useless return value variables.

    Are you sure gcc doesn't optimize them away? :-)

> Signed-off By: Trevor Pace <trevor.pace@dal.ca>

> ================================================================================

> diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
> index bd7581b..faec1d1 100644
> --- a/drivers/usb/serial/usb-serial.c
> +++ b/drivers/usb/serial/usb-serial.c

[...]

> @@ -437,11 +432,9 @@ static int serial_ioctl(struct tty_struct *tty, struct file
> *file,
> 
>  	/* pass on to the driver specific version of this function
>  	   if it is available */
> -	if (port->serial->type->ioctl) {
> -		retval = port->serial->type->ioctl(tty, file, cmd, arg);
> -	} else
> -		retval = -ENOIOCTLCMD;
> -	return retval;
> +	if (port->serial->type->ioctl)
> +		return port->serial->type->ioctl(tty, file, cmd, arg);
> +        return -ENOIOCTLCMD;

    Spaces instead of tab here...

> @@ -1185,24 +1178,21 @@ int usb_serial_suspend(struct usb_interface *intf,
> pm_message_t message)
>  	}
> 
>  	if (serial->type->suspend)
> -		r = serial->type->suspend(serial, message);
> +		return serial->type->suspend(serial, message);
> 
> -	return r;
> +	return 0;
>  }
>  EXPORT_SYMBOL(usb_serial_suspend);
> 
>  int usb_serial_resume(struct usb_interface *intf)
>  {
>  	struct usb_serial *serial = usb_get_intfdata(intf);
> -	int rv;
> 
>  	serial->suspending = 0;
> -	if (serial->type->resume)
> -		rv = serial->type->resume(serial);
> -	else
> -		rv = usb_serial_generic_resume(serial);
> 
> -	return rv;
> +	return (serial->type->resume)

    Parens totally not needed here.

> +		? serial->type->resume(serial)
> +		: usb_serial_generic_resume(serial);
>  }
>  EXPORT_SYMBOL(usb_serial_resume);

WBR, Sergei

  reply	other threads:[~2009-07-24 16:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24 15:48 [PATCH] Removed useless retval variables in usb-serial.c Trevor Pace
2009-07-24 16:29 ` Sergei Shtylyov [this message]
2009-07-24 17:06   ` Trevor Pace
2009-07-24 18:29     ` Greg KH
2009-07-24 16:53 ` Oliver Neukum
2009-07-24 19:16   ` Greg KH
2009-07-24 17:34 ` Greg KH
2009-07-24 18:02   ` Joe Perches
2009-07-24 18:12     ` Greg KH
     [not found]   ` <bad58e960907241047o7558a715u6a36535f2496c49d@mail.gmail.com>
2009-07-24 19:22     ` Fwd: " Trevor Pace

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=4A69E164.9040403@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tr212206@DAL.CA \
    /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