netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: amitkale@netxen.com
Cc: jgarzik@pobox.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: drivers/net/netxen/: usage of uninitialized variables
Date: Wed, 13 Dec 2006 14:07:21 +0100	[thread overview]
Message-ID: <20061213130721.GG3851@stusta.de> (raw)

The Coverity checker spotted the following places where variables are 
being used uninitialized:


drivers/net/netxen/netxen_nic_ethtool.c:

<--  snip  -->

...
static u32 netxen_nic_get_link(struct net_device *dev)
{
        struct netxen_port *port = netdev_priv(dev);
        struct netxen_adapter *adapter = port->adapter;
        __le32 status;

        /* read which mode */
        if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
                if (adapter->phy_read
                    && adapter->phy_read(adapter, port->portnum,
                                         NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
                                         &status) != 0)
                        return -EIO;
                else
                        return (netxen_get_phy_link(status));
...

<--  snip  -->

"status" is not initiazlized if !adapter->phy_read.


drivers/net/netxen/netxen_nic_ethtool.c:

<--  snip  -->

...
static int
netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd 
*ecmd)
{
        struct netxen_port *port = netdev_priv(dev);
        struct netxen_adapter *adapter = port->adapter;
        __le32 status;

        /* read which mode */
        if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
                /* autonegotiation */
                if (adapter->phy_write
                    && adapter->phy_write(adapter, port->portnum,
                                          NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
                                          (__le32) ecmd->autoneg) != 0)
                        return -EIO;
                else
                        port->link_autoneg = ecmd->autoneg;

                if (adapter->phy_read
                    && adapter->phy_read(adapter, port->portnum,
                                         NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
                                         &status) != 0)
                        return -EIO;

                /* speed */
                switch (ecmd->speed) {
                case SPEED_10:
                        netxen_set_phy_speed(status, 0);
                        break;
                case SPEED_100:
                        netxen_set_phy_speed(status, 1);
                        break;
                case SPEED_1000:
                        netxen_set_phy_speed(status, 2);
                        break;
                }
...

<--  snip  -->

"status" is not initiazlized if !adapter->phy_read.


drivers/net/netxen/netxen_nic_isr.c:

<--  snip  -->

void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
                            u32 enable)
{
        __le32 int_src;
        struct netxen_port *port;

        /*  This should clear the interrupt source */
        if (adapter->phy_read)
                adapter->phy_read(adapter, portno,
                                  NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS,
                                  &int_src);
        if (int_src == 0) {
                DPRINTK(INFO, "No phy interrupts for port #%d\n", portno);
                return;
        }
...

<--  snip  -->

"int_src" is not initiazlized if !adapter->phy_read.


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:[~2006-12-13 13:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061213130721.GG3851@stusta.de \
    --to=bunk@stusta.de \
    --cc=amitkale@netxen.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).