linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/tty: emove redundant assignment to variable i and rename it to ret
@ 2020-04-05 13:30 Colin King
  2020-04-05 13:35 ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2020-04-05 13:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, linux-serial
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable i is being assigned a value that is never read
and it is being updated later with a new value. The assignment
is redundant and can be removed.  Also rename i to ret as this new
name makes makes more sense.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/tty/serial/8250/serial_cs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
index c8186a05a453..e3d10794dbba 100644
--- a/drivers/tty/serial/8250/serial_cs.c
+++ b/drivers/tty/serial/8250/serial_cs.c
@@ -440,7 +440,7 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
 static int simple_config(struct pcmcia_device *link)
 {
 	struct serial_info *info = link->priv;
-	int i = -ENODEV, try;
+	int ret, try;
 
 	/*
 	 * First pass: look for a config entry that looks normal.
@@ -472,8 +472,8 @@ static int simple_config(struct pcmcia_device *link)
 	if (info->quirk && info->quirk->config)
 		info->quirk->config(link);
 
-	i = pcmcia_enable_device(link);
-	if (i != 0)
+	ret = pcmcia_enable_device(link);
+	if (ret != 0)
 		return -1;
 	return setup_serial(link, info, link->resource[0]->start, link->irq);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers/tty: emove redundant assignment to variable i and rename it to ret
  2020-04-05 13:30 [PATCH] drivers/tty: emove redundant assignment to variable i and rename it to ret Colin King
@ 2020-04-05 13:35 ` Colin Ian King
  2020-04-05 13:50   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Ian King @ 2020-04-05 13:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, linux-serial
  Cc: kernel-janitors, linux-kernel

Oops, typo on $SUBJECT, can "emove" be replaced with "remove" when this
is applied?

On 05/04/2020 14:30, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable i is being assigned a value that is never read
> and it is being updated later with a new value. The assignment
> is redundant and can be removed.  Also rename i to ret as this new
> name makes makes more sense.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/tty/serial/8250/serial_cs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
> index c8186a05a453..e3d10794dbba 100644
> --- a/drivers/tty/serial/8250/serial_cs.c
> +++ b/drivers/tty/serial/8250/serial_cs.c
> @@ -440,7 +440,7 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
>  static int simple_config(struct pcmcia_device *link)
>  {
>  	struct serial_info *info = link->priv;
> -	int i = -ENODEV, try;
> +	int ret, try;
>  
>  	/*
>  	 * First pass: look for a config entry that looks normal.
> @@ -472,8 +472,8 @@ static int simple_config(struct pcmcia_device *link)
>  	if (info->quirk && info->quirk->config)
>  		info->quirk->config(link);
>  
> -	i = pcmcia_enable_device(link);
> -	if (i != 0)
> +	ret = pcmcia_enable_device(link);
> +	if (ret != 0)
>  		return -1;
>  	return setup_serial(link, info, link->resource[0]->start, link->irq);
>  }
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers/tty: emove redundant assignment to variable i and rename it to ret
  2020-04-05 13:35 ` Colin Ian King
@ 2020-04-05 13:50   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-05 13:50 UTC (permalink / raw)
  To: Colin Ian King; +Cc: Jiri Slaby, linux-serial, kernel-janitors, linux-kernel

On Sun, Apr 05, 2020 at 02:35:43PM +0100, Colin Ian King wrote:
> Oops, typo on $SUBJECT, can "emove" be replaced with "remove" when this
> is applied?

It's easier if you fix it up and send it again, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-05 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 13:30 [PATCH] drivers/tty: emove redundant assignment to variable i and rename it to ret Colin King
2020-04-05 13:35 ` Colin Ian King
2020-04-05 13:50   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).