Re: [PATCH 67/76] tty: Remove lots of NULL checks

Geert Uytterhoeven
2008-10-06T08:58:19Z

On Sun, 5 Oct 2008, Alan Cox wrote:
> Many tty drivers contain 'can't happen' checks against NULL pointers passed
> in by the tty layer. These have never been possible to occur. Even more
> importantly if they ever do occur we want to know as it would be a serious
> bug.

> diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
> index ae377aa..c0a1df9 100644
> --- a/drivers/char/n_r3964.c
> +++ b/drivers/char/n_r3964.c
> @@ -372,15 +372,8 @@ static void remove_from_rx_queue(struct r3964_info *pInfo,
> static void put_char(struct r3964_info *pInfo, unsigned char ch)
> {
> struct tty_struct *tty = pInfo->tty;
> -
> - if (tty == NULL)
> - return;
> -
> /* FIXME: put_char should not be called from an IRQ */
> - if (tty->ops->put_char) {
> - tty->ops->put_char(tty, ch);
> - }
> - pInfo->bcc ^= ch;
^^^^^^^^^^^^^^^^
> + tty_put_char(tty, ch);
> }

I have no idea what this `bcc' thingy does, but its removal just struck
my eye...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds