Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ozwpan: Remove useless return variables

This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
- return ret;
+ return C;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Senna Tschudin and committed by
Greg Kroah-Hartman
a3c97192 ba910808

+2 -4
+2 -4
drivers/staging/ozwpan/ozhcd.c
··· 2011 2011 static int oz_set_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex) 2012 2012 { 2013 2013 struct oz_port *port; 2014 - int err = 0; 2015 2014 u8 port_id = (u8)windex; 2016 2015 struct oz_hcd *ozhcd = oz_hcd_private(hcd); 2017 2016 unsigned set_bits = 0; ··· 2077 2078 spin_unlock_bh(&port->port_lock); 2078 2079 } 2079 2080 oz_dbg(HUB, "Port[%d] status = 0x%x\n", port_id, port->status); 2080 - return err; 2081 + return 0; 2081 2082 } 2082 2083 2083 2084 /* ··· 2086 2087 static int oz_clear_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex) 2087 2088 { 2088 2089 struct oz_port *port; 2089 - int err = 0; 2090 2090 u8 port_id = (u8)windex; 2091 2091 struct oz_hcd *ozhcd = oz_hcd_private(hcd); 2092 2092 unsigned clear_bits = 0; ··· 2152 2154 } 2153 2155 oz_dbg(HUB, "Port[%d] status = 0x%x\n", 2154 2156 port_id, ozhcd->ports[port_id-1].status); 2155 - return err; 2157 + return 0; 2156 2158 } 2157 2159 2158 2160 /*