提交 5dca607b 编写于 作者: M Mike Frysinger 提交者: Linus Torvalds

tty: fix unused warning when TCGETX is not defined

If TCGETX is not defined, we end up with this warning:
drivers/char/tty_ioctl.c: In function ‘tty_mode_ioctl’:
drivers/char/tty_ioctl.c:950: warning: unused variable ‘ktermx’

Since the variable is only used in one case statement, push it down to
the local case scope.
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
Signed-off-by: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 677ca306
...@@ -947,7 +947,6 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, ...@@ -947,7 +947,6 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
void __user *p = (void __user *)arg; void __user *p = (void __user *)arg;
int ret = 0; int ret = 0;
struct ktermios kterm; struct ktermios kterm;
struct termiox ktermx;
if (tty->driver->type == TTY_DRIVER_TYPE_PTY && if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER) tty->driver->subtype == PTY_TYPE_MASTER)
...@@ -1049,7 +1048,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, ...@@ -1049,7 +1048,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
return ret; return ret;
#endif #endif
#ifdef TCGETX #ifdef TCGETX
case TCGETX: case TCGETX: {
struct termiox ktermx;
if (real_tty->termiox == NULL) if (real_tty->termiox == NULL)
return -EINVAL; return -EINVAL;
mutex_lock(&real_tty->termios_mutex); mutex_lock(&real_tty->termios_mutex);
...@@ -1058,6 +1058,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, ...@@ -1058,6 +1058,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
if (copy_to_user(p, &ktermx, sizeof(struct termiox))) if (copy_to_user(p, &ktermx, sizeof(struct termiox)))
ret = -EFAULT; ret = -EFAULT;
return ret; return ret;
}
case TCSETX: case TCSETX:
return set_termiox(real_tty, p, 0); return set_termiox(real_tty, p, 0);
case TCSETXW: case TCSETXW:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册