2020-09-21 03:33:32

by Jing Xiangfeng

[permalink] [raw]
Subject: [PATCH] net: unix: remove redundant assignment to variable 'err'

After commit 37ab4fa7844a ("net: unix: allow bind to fail on mutex lock"),
the assignment to err is redundant. So remove it.

Signed-off-by: Jing Xiangfeng <[email protected]>
---
net/unix/af_unix.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 92784e51ee7d..eb82bdc6cf7c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -878,7 +878,6 @@ static int unix_autobind(struct socket *sock)
if (err)
return err;

- err = 0;
if (u->addr)
goto out;

--
2.17.1


2020-09-21 21:53:44

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] net: unix: remove redundant assignment to variable 'err'

From: Jing Xiangfeng <[email protected]>
Date: Mon, 21 Sep 2020 11:29:52 +0800

> After commit 37ab4fa7844a ("net: unix: allow bind to fail on mutex lock"),
> the assignment to err is redundant. So remove it.
>
> Signed-off-by: Jing Xiangfeng <[email protected]>
...
> @@ -878,7 +878,6 @@ static int unix_autobind(struct socket *sock)
> if (err)
> return err;
>
> - err = 0;
> if (u->addr)
> goto out;

Yes, err is always zero here in this code path.

Applied, thanks.