Skip to content

Commit

Permalink
ser_gigaset: turn nonsense checks into WARN_ON
Browse files Browse the repository at this point in the history
These checks do nothing useful to protect the code from races. On the
other hand if the old code has been masking a real bug we would like to
know about it.

The check for tiocmset is kept because it is valid for a tty driver to
have a NULL tiocmset method. That in itself is probably a mistake given
modern coding practices - but needs fixing in the tty layer.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alan Cox authored and davem330 committed Dec 15, 2015
1 parent 74375c0 commit ede03d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/isdn/gigaset/ser-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ static int write_modem(struct cardstate *cs)
struct sk_buff *skb = bcs->tx_skb;
int sent = -EOPNOTSUPP;

if (!tty || !tty->ops || !skb)
return -EINVAL;
WARN_ON(!tty || !tty->ops || !skb);

if (!skb->len) {
dev_kfree_skb_any(skb);
Expand Down Expand Up @@ -109,8 +108,7 @@ static int send_cb(struct cardstate *cs)
unsigned long flags;
int sent = 0;

if (!tty || !tty->ops)
return -EFAULT;
WARN_ON(!tty || !tty->ops);

cb = cs->cmdbuf;
if (!cb)
Expand Down Expand Up @@ -432,7 +430,9 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
struct tty_struct *tty = cs->hw.ser->tty;
unsigned int set, clear;

if (!tty || !tty->ops || !tty->ops->tiocmset)
WARN_ON(!tty || !tty->ops);
/* tiocmset is an optional tty driver method */
if (!tty->ops->tiocmset)
return -EINVAL;
set = new_state & ~old_state;
clear = old_state & ~new_state;
Expand Down

0 comments on commit ede03d3

Please sign in to comment.