linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: pty: remove redundant initialization of variable fd
@ 2021-05-13 22:18 Colin King
  2021-05-14  6:51 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-05-13 22:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: kernel-janitors, linux-kernel

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

The variable fd is being initialized with a value that is never
read, it is being updated later on. The assignment is redundant and
can be removed.

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

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 9b5d4ae5d8f2..2251330e7e00 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -626,7 +626,7 @@ static struct cdev ptmx_cdev;
  */
 int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
 {
-	int fd = -1;
+	int fd;
 	struct file *filp;
 	int retval = -EINVAL;
 	struct path path;
-- 
2.30.2


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

* Re: [PATCH] tty: pty: remove redundant initialization of variable fd
  2021-05-13 22:18 [PATCH] tty: pty: remove redundant initialization of variable fd Colin King
@ 2021-05-14  6:51 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2021-05-14  6:51 UTC (permalink / raw)
  To: Colin King, Greg Kroah-Hartman; +Cc: kernel-janitors, linux-kernel

On 14. 05. 21, 0:18, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable fd is being initialized with a value that is never
> read, it is being updated later on. The assignment is redundant and
> can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/pty.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
> index 9b5d4ae5d8f2..2251330e7e00 100644
> --- a/drivers/tty/pty.c
> +++ b/drivers/tty/pty.c
> @@ -626,7 +626,7 @@ static struct cdev ptmx_cdev;
>    */
>   int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
>   {
> -	int fd = -1;
> +	int fd;
>   	struct file *filp;
>   	int retval = -EINVAL;
>   	struct path path;
> 


-- 
js
suse labs

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

end of thread, other threads:[~2021-05-14  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 22:18 [PATCH] tty: pty: remove redundant initialization of variable fd Colin King
2021-05-14  6:51 ` Jiri Slaby

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).