PCI: vmd: Fix two issues in VMD reported by Smatch
Subsystems (3)
v2 cover PCI: vmd: Fix two issues in VMD reported by Smatch
From: Xinghui Li <[email protected]>
Fix two issues when building kernel with Smatch check.
v1->v2:
According to Damien's suggestion, I split it from 1 patch to 2 different patches. Change 'inconsistent indenting' patch's title from 'fix' to 'clean up'.
Xinghui Li (2):
PCI: vmd: Fix one uninitialized symbol error reported by Smatch
PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
drivers/pci/controller/vmd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/2 PCI: vmd: Fix one uninitialized symbol error 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.
--- drivers/pci/controller/vmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/vmd.c +2 -1
@@ -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 ;
Signature · 1 line
2.31.1
PATCH v2 2/2 PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
In reply to [email protected]From: Xinghui Li <[email protected]>
There is 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/controller/vmd.c +4 -4
@@ -1056,10 +1056,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
Re: [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
Quoted 23 lines · On 4/20/2023 2:43 AM, [email protected] wrote:
From: Xinghui Li <[email protected]>
There is one inconsistent indenting warning:
"drivers/pci/controller/vmd.c:1058vmd_resume()
warn: inconsistent indenting"Fix it by formating its indenting.
Reported-by Dan Carpenter <[email protected]>Signed-off-by Xinghui Li <[email protected]>--- drivers/pci/controller/vmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/pci/controller/vmd.c +0
-1@@ -1056,10 +1056,10 @@ static int vmd_resume(struct device *dev)struct vmd_dev *vmd =pci_get_drvdata (pdev);int err, i; -if (vmd->irq_domain)
drivers/pci/controller/vmd.c static int vmd_resume(struct device *dev) · line 1065
Quoted 10 lines
drivers/pci/controller/vmd.c +4
-3-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,
Re: [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error reported by Smatch
In reply to [email protected]Quoted 20 lines · On 4/20/2023 2:43 AM, [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.Fixes 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")Reported-by Dan Carpenter <[email protected]>Signed-off-by Xinghui Li <[email protected]>--- drivers/pci/controller/vmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/controller/vmd.c +0
-0
drivers/pci/controller/vmd.c static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) · line 934
Quoted 9 lines
drivers/pci/controller/vmd.c +2
-1@@ -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 ;
Krzysztof Wilczyński
Applied[+CC Christoph]
Hello,
Quoted 9 lines
Fix two issues when building kernel with Smatch check.
v1->v2:
According to Damien's suggestion, I split it from 1 patch to 2 different patches. Change 'inconsistent indenting' patch's title from 'fix' to 'clean up'.Xinghui Li (2):
PCI: vmd: Fix one uninitialized symbol error reported by Smatch
Applied to controller/vmd, thank you!
[1/1] PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()
https://git.kernel.org/pci/pci/c/0c0206dc4f5b
Quoted 1 line
PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
Even though this is a very nice clean-up, I did not take this patch at this time, as there has been a similar patch posted in the past, and Christoph Hellwig suggested, as part of his review, an alternative approach worth considering.
Have a look at the following and let me know what you think:
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
Krzysztof
Quoted 6 lines · Krzysztof Wilczyński
[1/1] PCI: vmd: Fix uninitialized variable usage in
vmd_enable_domain()https://git.kernel.org/pci/pci/c/0c0206dc4f5bQuoted 1 line
PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
Quoted 8 lines
Even though this is a very nice clean-up, I did not take this patch at this time, as there has been a similar patch posted in the past, and Christoph Hellwig suggested, as part of his review, an alternative approach worth considering.
Have a look at the following and let me know what you think:
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
I think Christoph Hellwig's suggestion is indeed better. So, should I submit a new patch to address this issue?
Thanks~
Hello,
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
Even though this is a very nice clean-up, I did not take this patch at this time, as there has been a similar patch posted in the past, and Christoph Hellwig suggested, as part of his review, an alternative approach worth considering.
Quoted 6 lines
Quoted 3 lines
Have a look at the following and let me know what you think:
https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
I think Christoph Hellwig's suggestion is indeed better. So, should I submit a new patch to address this issue?
Please. A single new patch would suffice.
Make sure to explain as part of the commit log why this specific change that started as a Smatch complaint about an incorrect indentation.
Thank you!
Krzysztof