Commit a45a1e07 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

USB: serial: Eliminate useless code

The variables priv and portdata are initialized twice to the same (side
effect-free) expressions.  Drop one initialization in each case.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent aa790740
...@@ -691,7 +691,6 @@ static void cypress_dtr_rts(struct usb_serial_port *port, int on) ...@@ -691,7 +691,6 @@ static void cypress_dtr_rts(struct usb_serial_port *port, int on)
{ {
struct cypress_private *priv = usb_get_serial_port_data(port); struct cypress_private *priv = usb_get_serial_port_data(port);
/* drop dtr and rts */ /* drop dtr and rts */
priv = usb_get_serial_port_data(port);
spin_lock_irq(&priv->lock); spin_lock_irq(&priv->lock);
if (on == 0) if (on == 0)
priv->line_control = 0; priv->line_control = 0;
......
...@@ -477,7 +477,7 @@ static void sierra_outdat_callback(struct urb *urb) ...@@ -477,7 +477,7 @@ static void sierra_outdat_callback(struct urb *urb)
static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count) const unsigned char *buf, int count)
{ {
struct sierra_port_private *portdata = usb_get_serial_port_data(port); struct sierra_port_private *portdata;
struct sierra_intf_private *intfdata; struct sierra_intf_private *intfdata;
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
unsigned long flags; unsigned long flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment