[25/32] usb: early: ehci-dbgp: Remove set but never checked variable 'ret'

Message ID 20200706133341.476881-26-lee.jones@linaro.org
State New
Headers show
Series
  • Fix the final bunch of W=1 issues in USB
Related show

Commit Message

Lee Jones July 6, 2020, 1:33 p.m.
'ret' hasn't  been checked since the driver's inception in 2009.

Fixes the following W=1 kernel build warning(s):

 drivers/usb/early/ehci-dbgp.c: In function ‘early_dbgp_write’:
 drivers/usb/early/ehci-dbgp.c:915:13: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
 915 | int chunk, ret;
 | ^~~

Cc: Sumit Garg <sumit.garg@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/usb/early/ehci-dbgp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.25.1

Comments

Eric W. Biederman July 6, 2020, 4:56 p.m. | #1
Lee Jones <lee.jones@linaro.org> writes:

> 'ret' hasn't  been checked since the driver's inception in 2009.


Minor quibble the inception was in 5c05917e7fe3 ("x86: usb debug port
early console, v4") in July of 2008.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>


> Fixes the following W=1 kernel build warning(s):

>

>  drivers/usb/early/ehci-dbgp.c: In function ‘early_dbgp_write’:

>  drivers/usb/early/ehci-dbgp.c:915:13: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

>  915 | int chunk, ret;

>  | ^~~

>

> Cc: Sumit Garg <sumit.garg@linaro.org>

> Cc: Daniel Thompson <daniel.thompson@linaro.org>

> Cc: Douglas Anderson <dianders@chromium.org>

> Cc: Petr Mladek <pmladek@suse.com>

> Cc: "Eric W. Biederman" <ebiederm@xmission.com>

> Cc: Yinghai Lu <yhlu.kernel@gmail.com>

> Cc: Jason Wessel <jason.wessel@windriver.com>

> Signed-off-by: Lee Jones <lee.jones@linaro.org>

> ---

>  drivers/usb/early/ehci-dbgp.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

>

> diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c

> index 775cf70cfb3ed..b075dbfad730f 100644

> --- a/drivers/usb/early/ehci-dbgp.c

> +++ b/drivers/usb/early/ehci-dbgp.c

> @@ -912,7 +912,7 @@ int __init early_dbgp_init(char *s)

>  

>  static void early_dbgp_write(struct console *con, const char *str, u32 n)

>  {

> -	int chunk, ret;

> +	int chunk;

>  	char buf[DBGP_MAX_PACKET];

>  	int use_cr = 0;

>  	u32 cmd, ctrl;

> @@ -951,8 +951,8 @@ static void early_dbgp_write(struct console *con, const char *str, u32 n)

>  			buf[chunk] = *str;

>  		}

>  		if (chunk > 0) {

> -			ret = dbgp_bulk_write(USB_DEBUG_DEVNUM,

> -				      dbgp_endpoint_out, buf, chunk);

> +			dbgp_bulk_write(USB_DEBUG_DEVNUM,

> +					dbgp_endpoint_out, buf, chunk);

>  		}

>  	}

>  	if (unlikely(reset_run)) {
Lee Jones July 6, 2020, 5:57 p.m. | #2
On Mon, 06 Jul 2020, Eric W. Biederman wrote:

> Lee Jones <lee.jones@linaro.org> writes:

> 

> > 'ret' hasn't  been checked since the driver's inception in 2009.

> 

> Minor quibble the inception was in 5c05917e7fe3 ("x86: usb debug port

> early console, v4") in July of 2008.


I'm only going back as far as the inception of ehci-dbgp.c.

> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>


Great, thanks.

> > Fixes the following W=1 kernel build warning(s):

> >

> >  drivers/usb/early/ehci-dbgp.c: In function ‘early_dbgp_write’:

> >  drivers/usb/early/ehci-dbgp.c:915:13: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

> >  915 | int chunk, ret;

> >  | ^~~

> >

> > Cc: Sumit Garg <sumit.garg@linaro.org>

> > Cc: Daniel Thompson <daniel.thompson@linaro.org>

> > Cc: Douglas Anderson <dianders@chromium.org>

> > Cc: Petr Mladek <pmladek@suse.com>

> > Cc: "Eric W. Biederman" <ebiederm@xmission.com>

> > Cc: Yinghai Lu <yhlu.kernel@gmail.com>

> > Cc: Jason Wessel <jason.wessel@windriver.com>

> > Signed-off-by: Lee Jones <lee.jones@linaro.org>

> > ---

> >  drivers/usb/early/ehci-dbgp.c | 6 +++---

> >  1 file changed, 3 insertions(+), 3 deletions(-)


-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

Patch

diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index 775cf70cfb3ed..b075dbfad730f 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -912,7 +912,7 @@  int __init early_dbgp_init(char *s)
 
 static void early_dbgp_write(struct console *con, const char *str, u32 n)
 {
-	int chunk, ret;
+	int chunk;
 	char buf[DBGP_MAX_PACKET];
 	int use_cr = 0;
 	u32 cmd, ctrl;
@@ -951,8 +951,8 @@  static void early_dbgp_write(struct console *con, const char *str, u32 n)
 			buf[chunk] = *str;
 		}
 		if (chunk > 0) {
-			ret = dbgp_bulk_write(USB_DEBUG_DEVNUM,
-				      dbgp_endpoint_out, buf, chunk);
+			dbgp_bulk_write(USB_DEBUG_DEVNUM,
+					dbgp_endpoint_out, buf, chunk);
 		}
 	}
 	if (unlikely(reset_run)) {