mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>, Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: usb/serial/io_ti.c: inconsequent NULL checking
Date: Wed, 20 Feb 2008 00:49:15 +0200	[thread overview]
Message-ID: <20080219224915.GN31955@cs181133002.pp.htv.fi> (raw)

The Coverity checker spotted the following inconsequent NULL checking 
introduced by commit d5f5bcd425b771c0b7ff5a650b2ce061ac8bbb87:

<--  snip  -->

static int edge_open (struct usb_serial_port *port, struct file * filp)
{
...
        if (port->tty)   <---------------------------------------------
                port->tty->low_latency = low_latency;

        port_number = port->number - port->serial->minor;
        switch (port_number) {
                case 0:
                        edge_port->uart_base = UMPMEM_BASE_UART1;
                        edge_port->dma_address = UMPD_OEDB1_ADDRESS;
                        break;
                case 1:
                        edge_port->uart_base = UMPMEM_BASE_UART2;
                        edge_port->dma_address = UMPD_OEDB2_ADDRESS;
                        break;
                default:
                        dev_err (&port->dev, "Unknown port number!!!\n");
                        return -ENODEV;
        }

        dbg ("%s - port_number = %d, uart_base = %04x, dma_address = %04x",
             __FUNCTION__, port_number, edge_port->uart_base, edge_port->dma_address);

        dev = port->serial->dev;

        memset (&(edge_port->icount), 0x00, sizeof(edge_port->icount));
        init_waitqueue_head (&edge_port->delta_msr_wait);

        /* turn off loopback */
        status = TIClearLoopBack (edge_port);
        if (status) {
                dev_err(&port->dev,"%s - cannot send clear loopback command, %d\n",
                        __FUNCTION__, status);
                return status;
        }
        
        /* set up the port settings */
        edge_set_termios (port, port->tty->termios);
...                             ^^^^^^^^^^^^^^^^^^

<--  snip  -->

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


             reply	other threads:[~2008-02-19 22:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 22:49 Adrian Bunk [this message]
2008-02-19 23:25 ` Greg KH
2008-02-19 23:38   ` Ray Lee
2008-02-22 10:10     ` Alan Cox
2008-02-22 19:58       ` [2.6 patch] usb/serial/io_ti.c: remove unneeded NULL check Adrian Bunk
2008-02-22 19:56         ` Alan Cox

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=20080219224915.GN31955@cs181133002.pp.htv.fi \
    --to=bunk@kernel.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®