diff mbox series

net: usb: qmi_wwan: remove redundant assignment to variable status

Message ID 20200509215756.506840-2-colin.king@canonical.com (mailing list archive)
State Mainlined
Commit b9f96423bba6155cdf54f96f0b1e43fa6d0b0b74
Headers show
Series net: usb: qmi_wwan: remove redundant assignment to variable status | expand

Commit Message

Colin King May 9, 2020, 9:57 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable status is being initializeed with a value that is never read
and it is being updated later with a new value. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/usb/qmi_wwan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjørn Mork May 10, 2020, 7:41 a.m. UTC | #1
Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> The variable status is being initializeed with a value that is never read
> and it is being updated later with a new value. The initialization
> is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/usb/qmi_wwan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
> index 4bb8552a00d3..b0eab6e5279d 100644
> --- a/drivers/net/usb/qmi_wwan.c
> +++ b/drivers/net/usb/qmi_wwan.c
> @@ -719,7 +719,7 @@ static int qmi_wwan_change_dtr(struct usbnet *dev, bool on)
>  
>  static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
>  {
> -	int status = -1;
> +	int status;
>  	u8 *buf = intf->cur_altsetting->extra;
>  	int len = intf->cur_altsetting->extralen;
>  	struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;


Yes, looks like this initialization was made redundant when the CDC
descriptor parsing was moved to usbcore. Thanks.

Adding Fixes for documentation only, not as a stable hint.  This is
cleanup only and not suitable for stable IMHO.

Acked-by: Bjørn Mork <bjorn@mork.no>
Fixes: 8492ed45aa5d ("qmi-wwan: use common parser")
Jakub Kicinski May 10, 2020, 6:14 p.m. UTC | #2
On Sat,  9 May 2020 22:57:56 +0100 Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable status is being initializeed with a value that is never read
> and it is being updated later with a new value. The initialization
> is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied the 3 fixes from Saturday to net-next, thanks.
diff mbox series

Patch

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 4bb8552a00d3..b0eab6e5279d 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -719,7 +719,7 @@  static int qmi_wwan_change_dtr(struct usbnet *dev, bool on)
 
 static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
 {
-	int status = -1;
+	int status;
 	u8 *buf = intf->cur_altsetting->extra;
 	int len = intf->cur_altsetting->extralen;
 	struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;