Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752186AbbLLSRd (ORCPT ); Sat, 12 Dec 2015 13:17:33 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52909 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbbLLSRb (ORCPT ); Sat, 12 Dec 2015 13:17:31 -0500 X-Sasl-enc: 8D+XKSASaJQyCMnQXQzVDQD/JJZmrcEXXABIQuYScCPs 1449944240 Subject: Re: [PATCH] gigaset: turn nonsense checks into WARN_ON To: Alan Cox , linux-kernel@vger.kernel.org References: <20151209203248.16771.25053.stgit@localhost.localdomain> Cc: Paul Bolle From: Tilman Schmidt X-Enigmail-Draft-Status: N1110 Message-ID: <566C64AF.4020702@imap.cc> Date: Sat, 12 Dec 2015 19:17:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151209203248.16771.25053.stgit@localhost.localdomain> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mV1FUvhppHdboPUeQohaCDFPC3mXahJsd" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3162 Lines: 96 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mV1FUvhppHdboPUeQohaCDFPC3mXahJsd Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Am 09.12.2015 um 21:33 schrieb Alan Cox: > These checks do nothing useful to protect the code from races. On the o= ther > hand if the old code has been masking a real bug we would like to know = about > it. >=20 > 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 mode= rn > coding practices - but needs fixing in the tty layer. >=20 > Signed-off-by: Alan Cox Acked-by: Tilman Schmidt (Overlooking the nettling subject line.) > --- > drivers/isdn/gigaset/ser-gigaset.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > 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 =3D bcs->tx_skb; > int sent =3D -EOPNOTSUPP; > =20 > - if (!tty || !tty->ops || !skb) > - return -EINVAL; > + WARN_ON(!tty || !tty->ops || !skb); > =20 > if (!skb->len) { > dev_kfree_skb_any(skb); > @@ -109,8 +108,7 @@ static int send_cb(struct cardstate *cs) > unsigned long flags; > int sent =3D 0; > =20 > - if (!tty || !tty->ops) > - return -EFAULT; > + WARN_ON(!tty || !tty->ops); > =20 > cb =3D cs->cmdbuf; > if (!cb) > @@ -432,7 +430,9 @@ static int gigaset_set_modem_ctrl(struct cardstate = *cs, unsigned old_state, > struct tty_struct *tty =3D cs->hw.ser->tty; > unsigned int set, clear; > =20 > - 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 =3D new_state & ~old_state; > clear =3D old_state & ~new_state; >=20 --=20 Tilman Schmidt E-Mail: tilman@imap.cc Bonn, Germany Nous, on a des fleurs et des bougies pour nous prot=C3=A9ger. --mV1FUvhppHdboPUeQohaCDFPC3mXahJsd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWbGSvAAoJEFPuqx0v+F+qZooH/2KP65HV5cQ+Ko+dgWMwZz0R 5Pz2m+YeySEsk28oVC6/X+I3tedfmWGAjmhx5ifyHB2Mt81Vcodv5zmD9SUBgYsT HjxPC91nZceknO4cjl49Tro+/3e/V5ZWJtwcDVmIYx7S+O6A9KieIBR8AtTPy8U7 vwj4ObRM3K1H/4/VtAxMK1H4Hx5TAJ5i6EuO7n7GjOs8/GoGAXE+e0HVoA+wJm0z Z8TC1LeLv65kCAHkiP8dasB83nIz7vKrZb5bZEca0Ym86Uqdra8jleoGa8HeQCrS Iv1lLsSCMpcP48Txwn3tIFQo3rircZ2QYLN5MwwiJv5OoSlt6G6wBBgLtm+ldLg= =+WHr -----END PGP SIGNATURE----- --mV1FUvhppHdboPUeQohaCDFPC3mXahJsd-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/