On Fri, Apr 14, 2023 at 10:30:57PM +0000, Klemens Nanni wrote: > Saw 'error = ifioctl(); return error;' which I did not fold when removing > the lock around the call back then. > > That should be simplified, but the variable could be dropped completely. > Or is it likely to be used in future versions of this function?
> - error = sigio_setown(&so->so_sigio, cmd, data); > + return sigio_setown(&so->so_sigio, cmd, data); > break; Zap the now redundant 'break' as well. Index: sys_socket.c =================================================================== RCS file: /cvs/src/sys/kern/sys_socket.c,v retrieving revision 1.60 diff -u -p -r1.60 sys_socket.c --- sys_socket.c 22 Jan 2023 12:05:44 -0000 1.60 +++ sys_socket.c 14 Apr 2023 22:32:30 -0000 @@ -83,7 +83,6 @@ int soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) { struct socket *so = (struct socket *)fp->f_data; - int error = 0; switch (cmd) { @@ -109,8 +108,7 @@ soo_ioctl(struct file *fp, u_long cmd, c case FIOSETOWN: case SIOCSPGRP: case TIOCSPGRP: - error = sigio_setown(&so->so_sigio, cmd, data); - break; + return sigio_setown(&so->so_sigio, cmd, data); case FIOGETOWN: case SIOCGPGRP: @@ -128,17 +126,14 @@ soo_ioctl(struct file *fp, u_long cmd, c * interface and routing ioctls should have a * different entry since a socket's unnecessary */ - if (IOCGROUP(cmd) == 'i') { - error = ifioctl(so, cmd, data, p); - return (error); - } + if (IOCGROUP(cmd) == 'i') + return ifioctl(so, cmd, data, p); if (IOCGROUP(cmd) == 'r') return (EOPNOTSUPP); - error = pru_control(so, cmd, data, NULL); - break; + return pru_control(so, cmd, data, NULL); } - return (error); + return (0); } int