linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: Alan Cox <alan@linux.intel.com>, linux-kernel@vger.kernel.org
Cc: Paul Bolle <pebolle@tiscali.nl>
Subject: Re: [PATCH] gigaset: turn nonsense checks into WARN_ON
Date: Sat, 12 Dec 2015 19:17:19 +0100	[thread overview]
Message-ID: <566C64AF.4020702@imap.cc> (raw)
In-Reply-To: <20151209203248.16771.25053.stgit@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2031 bytes --]

Am 09.12.2015 um 21:33 schrieb Alan Cox:
> 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>

(Overlooking the nettling subject line.)

> ---
>  drivers/isdn/gigaset/ser-gigaset.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
> index d8771b5..8e21f6af 100644
> --- a/drivers/isdn/gigaset/ser-gigaset.c
> +++ b/drivers/isdn/gigaset/ser-gigaset.c
> @@ -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);
> @@ -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)
> @@ -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;
> 

-- 
Tilman Schmidt                              E-Mail: tilman@imap.cc
Bonn, Germany
Nous, on a des fleurs et des bougies pour nous protéger.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2015-12-12 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 20:33 [PATCH] gigaset: turn nonsense checks into WARN_ON Alan Cox
2015-12-12 18:17 ` Tilman Schmidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566C64AF.4020702@imap.cc \
    --to=tilman@imap.cc \
    --cc=alan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).