Commit e7214663 authored by Simon Horman's avatar Simon Horman Committed by David S. Miller

net: txgbe: Avoid passing uninitialised parameter to pci_wake_from_d3()

txgbe_shutdown() relies on txgbe_dev_shutdown() to initialise
wake by passing it by reference. However, txgbe_dev_shutdown()
doesn't use this parameter at all.

wake is then passed uninitialised by txgbe_dev_shutdown()
to pci_wake_from_d3().

Resolve this problem by:
* Removing the unused parameter from txgbe_dev_shutdown()
* Removing the uninitialised variable wake from txgbe_dev_shutdown()
* Passing false to pci_wake_from_d3() - this assumes that
  although uninitialised wake was in practice false (0).

I'm not sure that this counts as a bug, as I'm not sure that
it manifests in any unwanted behaviour. But in any case, the issue
was introduced by:

  3ce7547e ("net: txgbe: Add build support for txgbe")

Flagged by Smatch as:

  .../txgbe_main.c:486 txgbe_shutdown() error: uninitialized symbol 'wake'.

No functional change intended.
Compile tested only.
Signed-off-by: default avatarSimon Horman <horms@kernel.org>
Reviewed-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 92db9e2e
...@@ -457,7 +457,7 @@ static int txgbe_close(struct net_device *netdev) ...@@ -457,7 +457,7 @@ static int txgbe_close(struct net_device *netdev)
return 0; return 0;
} }
static void txgbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake) static void txgbe_dev_shutdown(struct pci_dev *pdev)
{ {
struct wx *wx = pci_get_drvdata(pdev); struct wx *wx = pci_get_drvdata(pdev);
struct net_device *netdev; struct net_device *netdev;
...@@ -477,12 +477,10 @@ static void txgbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -477,12 +477,10 @@ static void txgbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
static void txgbe_shutdown(struct pci_dev *pdev) static void txgbe_shutdown(struct pci_dev *pdev)
{ {
bool wake; txgbe_dev_shutdown(pdev);
txgbe_dev_shutdown(pdev, &wake);
if (system_state == SYSTEM_POWER_OFF) { if (system_state == SYSTEM_POWER_OFF) {
pci_wake_from_d3(pdev, wake); pci_wake_from_d3(pdev, false);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment