public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Oliver Neukum <oneukum@suse.de>, Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: usb_serial_suspend(): buggy(?) code
Date: Mon, 23 Jul 2007 03:51:28 +0200	[thread overview]
Message-ID: <20070723015128.GY26212@stusta.de> (raw)

Commit ec22559e0b7a05283a3413bda5d177e42c950e23 added the following 
function to drivers/usb/serial/usb-serial.c:

<--  snip  -->

...
int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
{
        struct usb_serial *serial = usb_get_intfdata(intf);
        struct usb_serial_port *port;
        int i, r = 0;

        if (serial) {
                for (i = 0; i < serial->num_ports; ++i) {
                        port = serial->port[i];
                        if (port)
                                kill_traffic(port);
                }
        }

        if (serial->type->suspend)
                serial->type->suspend(serial, message);

        return r;
}
...

<--  snip  -->

The Coverity checker spotted the inconsequent NULL checking for "serial".

Looking at the code it also doesn't seem to have been intended to always 
return 0.

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:[~2007-07-23  1:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23  1:51 Adrian Bunk [this message]
2007-07-23  6:58 ` usb_serial_suspend(): buggy(?) code Oliver Neukum

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=20070723015128.GY26212@stusta.de \
    --to=bunk@stusta.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=oneukum@suse.de \
    /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