aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinghui Li <[email protected]>2023-04-20 17:43:31 +0800
committerKrzysztof Wilczyński <[email protected]>2023-06-24 16:09:16 +0000
commit0c0206dc4f5ba2d18b15e24d2047487d6f73916b (patch)
tree573d24686d3c3279cd2e1160bc768a868dac1ec2
parentb61cf04c49c3dfa70a0d6725d3eb40bf9b35cf71 (diff)
PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()
The ret variable in the vmd_enable_domain() function was used uninitialized when printing a warning message upon failure of the pci_reset_bus() function. Thus, fix the issue by assigning ret with the value returned from pci_reset_bus() before referencing it in the warning message. This was detected by Smatch: drivers/pci/controller/vmd.c:931 vmd_enable_domain() error: uninitialized symbol 'ret'. [kwilczynski: drop the second patch from the series, add missing reported by tag, commit log] Fixes: 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges") Link: https://lore.kernel.org/all/[email protected] Link: https://lore.kernel.org/linux-pci/[email protected] Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Xinghui Li <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Nirmal Patel <[email protected]>
-rw-r--r--drivers/pci/controller/vmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 30ec18283aaf..e718a816d481 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -927,7 +927,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
if (!list_empty(&child->devices)) {
dev = list_first_entry(&child->devices,
struct pci_dev, bus_list);
- if (pci_reset_bus(dev))
+ ret = pci_reset_bus(dev);
+ if (ret)
pci_warn(dev, "can't reset device: %d\n", ret);
break;