PCI: vmd: Fix two issues reported by Smatch
Subsystems (3)
PATCH 1/1 PCI: vmd: Fix two issues reported by Smatch
From: Xinghui Li <[email protected]>
There is one uninitialized symbol error reported by smatch:
"drivers/pci/controller/vmd.c:931 vmd_enable_domain()
error: uninitialized symbol 'ret'."
Fix it by assigning ret with pci_reset_bus return.
And one inconsistent indenting warning:
"drivers/pci/controller/vmd.c:1058 vmd_resume()
warn: inconsistent indenting"
Fix it by formating its indenting.
--- drivers/pci/controller/vmd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/controller/vmd.c +6 -5
@@ -943,7 +943,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 ;
@@ -1084,10 +1085,10 @@ static int vmd_resume(struct device *dev)struct vmd_dev *vmd =pci_get_drvdata (pdev);int err, i; -if (vmd->irq_domain) -vmd_set_msi_remapping (vmd, true); -else -vmd_set_msi_remapping (vmd, false); +if (vmd->irq_domain) +vmd_set_msi_remapping (vmd, true); +else +vmd_set_msi_remapping (vmd, false);for (i =0 ; i < vmd->msix_count; i++) { err = devm_request_irq(dev, vmd->irqs[i].virq,
Signature · 1 line
2.31.1
Quoted 7 lines · On 4/20/23 17:19, [email protected] wrote:
From: Xinghui Li <[email protected]>
There is one uninitialized symbol error reported by smatch:
"drivers/pci/controller/vmd.c:931vmd_enable_domain()
error: uninitialized symbol 'ret'."Fix it by assigning ret with
pci_reset_busreturn.
This is a bug so clearly needs a fixes tag.
Quoted 6 lines
And one inconsistent indenting warning:
"drivers/pci/controller/vmd.c:1058vmd_resume()
warn: inconsistent indenting"Fix it by formating its indenting.
But this is cosmetic and does not need backporting/fixes tag in my opinion. So better split this into 2 different patches.
Quoted 38 lines
Fixes 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")Fixes d899aa668498 ("PCI: vmd: Disable MSI remapping after suspend")Reported-by Dan Carpenter <[email protected]>Signed-off-by Xinghui Li <[email protected]>--- drivers/pci/controller/vmd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/pci/controller/vmd.c +6
-5@@ -943,7 +943,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 ;@@ -1084,10 +1085,10 @@ static int vmd_resume(struct device *dev)struct vmd_dev *vmd =pci_get_drvdata (pdev);int err, i; -if (vmd->irq_domain) -vmd_set_msi_remapping (vmd, true); -else -vmd_set_msi_remapping (vmd, false); +if (vmd->irq_domain) +vmd_set_msi_remapping (vmd, true); +else +vmd_set_msi_remapping (vmd, false);for (i =0 ; i < vmd->msix_count; i++) { err = devm_request_irq(dev, vmd->irqs[i].virq,
Quoted 10 lines · Damien Le Moal
Quoted 6 lines
And one inconsistent indenting warning:
"drivers/pci/controller/vmd.c:1058vmd_resume()
warn: inconsistent indenting"Fix it by formating its indenting.
But this is cosmetic and does not need backporting/fixes tag in my opinion. So better split this into 2 different patches.
Got it.
I will split it.
Thanks~