Skip to content

Commit e2e52c8

Browse files
Xinghui Ligregkh
authored andcommitted
PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()
[ Upstream commit 0c0206d ] 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: 0a58465 ("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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 222f64e commit e2e52c8

File tree

1 file changed

+2
-1
lines changed
  • drivers/pci/controller

1 file changed

+2
-1
lines changed

drivers/pci/controller/vmd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
872872
if (!list_empty(&child->devices)) {
873873
dev = list_first_entry(&child->devices,
874874
struct pci_dev, bus_list);
875-
if (pci_reset_bus(dev))
875+
ret = pci_reset_bus(dev);
876+
if (ret)
876877
pci_warn(dev, "can't reset device: %d\n", ret);
877878

878879
break;

0 commit comments

Comments
 (0)