Skip to content

Commit 0c0206d

Browse files
Xinghui Likwilczynski
authored andcommitted
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: 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]>
1 parent b61cf04 commit 0c0206d

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
@@ -927,7 +927,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
927927
if (!list_empty(&child->devices)) {
928928
dev = list_first_entry(&child->devices,
929929
struct pci_dev, bus_list);
930-
if (pci_reset_bus(dev))
930+
ret = pci_reset_bus(dev);
931+
if (ret)
931932
pci_warn(dev, "can't reset device: %d\n", ret);
932933

933934
break;

0 commit comments

Comments
 (0)