Skip to contentSkip to conversation

tty: Change tty lock order to master->slave

DISCUSSION Dan Carpenter 2 participants 2 messages Nov 11, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Peter Hurley,

The patch 2aff5e2bc62d: "tty: Change tty lock order to master->slave" from Nov 5, 2014, leads to the following static checker warning:

	drivers/tty/tty_mutex.c:50 tty_lock_slave()
	warn: add some parenthesis here?

drivers/tty/tty_mutex.c

    47  void __lockfunc tty_lock_slave(struct tty_struct *tty)
    48  {
    49          if (tty && tty != tty->link) {
    50                  WARN_ON(!mutex_is_locked(&tty->link->legacy_mutex) ||
    51                          !tty->driver->type = TTY_DRIVER_TYPE_PTY ||
    52                          !tty->driver->type = PTY_TYPE_SLAVE);

! has high precedence than = so those tests are never true. != doesn't make sense either. Probably the negate operatons are just copy-and-paste errors?

    53                  tty_lock(tty);
    54          }
    55  }

regards,
dan carpenter

#1 lore raw
Quoted 16 lines · Dan Carpenter

Hello Peter Hurley,

The patch 2aff5e2bc62d: "tty: Change tty lock order to master->slave" from Nov 5, 2014, leads to the following static checker warning:

	drivers/tty/tty_mutex.c:50 tty_lock_slave()
	warn: add some parenthesis here?

drivers/tty/tty_mutex.c

    47  void __lockfunc tty_lock_slave(struct tty_struct *tty)
    48  {
    49          if (tty && tty != tty->link) {
    50                  WARN_ON(!mutex_is_locked(&tty->link->legacy_mutex) ||
    51                          !tty->driver->type = TTY_DRIVER_TYPE_PTY ||
    52                          !tty->driver->type = PTY_TYPE_SLAVE);
Quoted 3 lines

! has high precedence than = so those tests are never true. != doesn't make sense either. Probably the negate operatons are just copy-and-paste errors?

Thanks for catching this, Dan.

Unfortunately, this is not a copy-and-paste error; apparently, emacs cannot code-what-I-mean rather than code-what-I-type.

The warning is not necessary now; when I respun this series with fixed lock subclasses I should have ripped this out. I will send a patch forthwith.

Regards,
Peter Hurley

Quoted 6 lines
    53                  tty_lock(tty);
    54          }
    55  }

regards,
dan carpenter