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

From: Geert Uytterhoeven
Date: Mon Oct 06 2008 - 04:58:20 EST


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@xxxxxxxxxxxxxx

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/