Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] sock_get_timeout: drop unnecessary return variable
@ 2019-10-10  4:08 Vito Caputo
  2019-10-12  3:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vito Caputo @ 2019-10-10  4:08 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel

Remove pointless use of size return variable by directly returning
sizes.

Signed-off-by: Vito Caputo <vcaputo@pengaru.com>
---
 net/core/sock.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index fac2b4d80de5..e01ff0d3be95 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -333,7 +333,6 @@ EXPORT_SYMBOL(__sk_backlog_rcv);
 static int sock_get_timeout(long timeo, void *optval, bool old_timeval)
 {
 	struct __kernel_sock_timeval tv;
-	int size;
 
 	if (timeo == MAX_SCHEDULE_TIMEOUT) {
 		tv.tv_sec = 0;
@@ -354,13 +353,11 @@ static int sock_get_timeout(long timeo, void *optval, bool old_timeval)
 		old_tv.tv_sec = tv.tv_sec;
 		old_tv.tv_usec = tv.tv_usec;
 		*(struct __kernel_old_timeval *)optval = old_tv;
-		size = sizeof(old_tv);
-	} else {
-		*(struct __kernel_sock_timeval *)optval = tv;
-		size = sizeof(tv);
+		return sizeof(old_tv);
 	}
 
-	return size;
+	*(struct __kernel_sock_timeval *)optval = tv;
+	return sizeof(tv);
 }
 
 static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen, bool old_timeval)
-- 
2.11.0


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

* Re: [PATCH] sock_get_timeout: drop unnecessary return variable
  2019-10-10  4:08 [PATCH] sock_get_timeout: drop unnecessary return variable Vito Caputo
@ 2019-10-12  3:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-10-12  3:45 UTC (permalink / raw)
  To: vcaputo; +Cc: netdev, linux-kernel

From: Vito Caputo <vcaputo@pengaru.com>
Date: Wed, 9 Oct 2019 21:08:24 -0700

> Remove pointless use of size return variable by directly returning
> sizes.
> 
> Signed-off-by: Vito Caputo <vcaputo@pengaru.com>

Looks good, applied to net-next.

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10  4:08 [PATCH] sock_get_timeout: drop unnecessary return variable Vito Caputo
2019-10-12  3:45 ` David Miller

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox