* [PATCH] PCI: vmd: Fix two issues reported by Smatch
@ 2023-04-20 8:19 korantwork
2023-04-20 8:23 ` Damien Le Moal
0 siblings, 1 reply; 3+ messages in thread
From: korantwork @ 2023-04-20 8:19 UTC (permalink / raw)
To: helgaas, nirmal.patel, kbusch, jonathan.derrick, lpieralisi
Cc: linux-pci, linux-kernel, Xinghui Li, Dan Carpenter
From: Xinghui Li <korantli@tencent.com>
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.
Fixes: 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")
Fixes: d899aa668498 ("PCI: vmd: Disable MSI remapping after suspend")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
---
drivers/pci/controller/vmd.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 7e1fd959e00d..0a7c1fdfeec0 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -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,
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] PCI: vmd: Fix two issues reported by Smatch
2023-04-20 8:19 [PATCH] PCI: vmd: Fix two issues reported by Smatch korantwork
@ 2023-04-20 8:23 ` Damien Le Moal
2023-04-20 8:31 ` Xinghui Li
0 siblings, 1 reply; 3+ messages in thread
From: Damien Le Moal @ 2023-04-20 8:23 UTC (permalink / raw)
To: korantwork, helgaas, nirmal.patel, kbusch, jonathan.derrick,
lpieralisi
Cc: linux-pci, linux-kernel, Xinghui Li, Dan Carpenter
On 4/20/23 17:19, korantwork@gmail.com wrote:
> From: Xinghui Li <korantli@tencent.com>
>
> 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.
This is a bug so clearly needs a fixes tag.
>
> And one inconsistent indenting warning:
> "drivers/pci/controller/vmd.c:1058 vmd_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.
>
> Fixes: 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")
> Fixes: d899aa668498 ("PCI: vmd: Disable MSI remapping after suspend")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Xinghui Li <korantli@tencent.com>
> ---
> drivers/pci/controller/vmd.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 7e1fd959e00d..0a7c1fdfeec0 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -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,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] PCI: vmd: Fix two issues reported by Smatch
2023-04-20 8:23 ` Damien Le Moal
@ 2023-04-20 8:31 ` Xinghui Li
0 siblings, 0 replies; 3+ messages in thread
From: Xinghui Li @ 2023-04-20 8:31 UTC (permalink / raw)
To: Damien Le Moal
Cc: helgaas, nirmal.patel, kbusch, jonathan.derrick, lpieralisi,
linux-pci, linux-kernel, Xinghui Li, Dan Carpenter
On Thu, Apr 20, 2023 at 4:23 PM Damien Le Moal <dlemoal@kernel.org> wrote:
>
> > And one inconsistent indenting warning:
> > "drivers/pci/controller/vmd.c:1058 vmd_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~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-20 8:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20 8:19 [PATCH] PCI: vmd: Fix two issues reported by Smatch korantwork
2023-04-20 8:23 ` Damien Le Moal
2023-04-20 8:31 ` Xinghui Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox