netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/netxen/: usage of uninitialized variables
@ 2006-12-13 13:07 Adrian Bunk
  0 siblings, 0 replies; only message in thread
From: Adrian Bunk @ 2006-12-13 13:07 UTC (permalink / raw)
  To: amitkale; +Cc: jgarzik, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-13 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-13 13:07 drivers/net/netxen/: usage of uninitialized variables Adrian Bunk

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).