Skip to content

Commit 28e72b2

Browse files
vcaputodavem330
authored andcommitted
sock_get_timeout: drop unnecessary return variable
Remove pointless use of size return variable by directly returning sizes. Signed-off-by: Vito Caputo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 262ce0a commit 28e72b2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

net/core/sock.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ EXPORT_SYMBOL(__sk_backlog_rcv);
333333
static int sock_get_timeout(long timeo, void *optval, bool old_timeval)
334334
{
335335
struct __kernel_sock_timeval tv;
336-
int size;
337336

338337
if (timeo == MAX_SCHEDULE_TIMEOUT) {
339338
tv.tv_sec = 0;
@@ -354,13 +353,11 @@ static int sock_get_timeout(long timeo, void *optval, bool old_timeval)
354353
old_tv.tv_sec = tv.tv_sec;
355354
old_tv.tv_usec = tv.tv_usec;
356355
*(struct __kernel_old_timeval *)optval = old_tv;
357-
size = sizeof(old_tv);
358-
} else {
359-
*(struct __kernel_sock_timeval *)optval = tv;
360-
size = sizeof(tv);
356+
return sizeof(old_tv);
361357
}
362358

363-
return size;
359+
*(struct __kernel_sock_timeval *)optval = tv;
360+
return sizeof(tv);
364361
}
365362

366363
static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen, bool old_timeval)

0 commit comments

Comments
 (0)