* [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch
@ 2023-04-20 9:43 korantwork
2023-04-20 9:43 ` [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error " korantwork
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: korantwork @ 2023-04-20 9:43 UTC (permalink / raw)
To: dlemoal, helgaas, nirmal.patel, kbusch, jonathan.derrick, lpieralisi
Cc: linux-pci, linux-kernel, Xinghui Li
From: Xinghui Li <korantli@tencent.com>
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(-)
--
2.31.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error reported by Smatch
2023-04-20 9:43 [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch korantwork
@ 2023-04-20 9:43 ` korantwork
2023-04-20 23:59 ` Patel, Nirmal
2023-04-20 9:43 ` [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn " korantwork
2023-06-24 16:33 ` [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD " Krzysztof Wilczyński
2 siblings, 1 reply; 8+ messages in thread
From: korantwork @ 2023-04-20 9:43 UTC (permalink / raw)
To: dlemoal, 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.
Fixes: 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
---
drivers/pci/controller/vmd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 990630ec57c6..1a36e9a52b93 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -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;
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
2023-04-20 9:43 [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch korantwork
2023-04-20 9:43 ` [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error " korantwork
@ 2023-04-20 9:43 ` korantwork
2023-04-20 23:59 ` Patel, Nirmal
2023-06-24 16:33 ` [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD " Krzysztof Wilczyński
2 siblings, 1 reply; 8+ messages in thread
From: korantwork @ 2023-04-20 9:43 UTC (permalink / raw)
To: dlemoal, 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 inconsistent indenting warning:
"drivers/pci/controller/vmd.c:1058 vmd_resume()
warn: inconsistent indenting"
Fix it by formating its indenting.
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
---
drivers/pci/controller/vmd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 1a36e9a52b93..1b68fa606bff 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -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,
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn reported by Smatch
2023-04-20 9:43 ` [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn " korantwork
@ 2023-04-20 23:59 ` Patel, Nirmal
0 siblings, 0 replies; 8+ messages in thread
From: Patel, Nirmal @ 2023-04-20 23:59 UTC (permalink / raw)
To: korantwork, dlemoal, helgaas, kbusch, jonathan.derrick, lpieralisi
Cc: linux-pci, linux-kernel, Xinghui Li, Dan Carpenter
On 4/20/2023 2:43 AM, korantwork@gmail.com wrote:
> From: Xinghui Li <korantli@tencent.com>
>
> There is one inconsistent indenting warning:
> "drivers/pci/controller/vmd.c:1058 vmd_resume()
> warn: inconsistent indenting"
>
> Fix it by formating its indenting.
>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Xinghui Li <korantli@tencent.com>
> ---
> drivers/pci/controller/vmd.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 1a36e9a52b93..1b68fa606bff 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -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,
Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error reported by Smatch
2023-04-20 9:43 ` [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error " korantwork
@ 2023-04-20 23:59 ` Patel, Nirmal
0 siblings, 0 replies; 8+ messages in thread
From: Patel, Nirmal @ 2023-04-20 23:59 UTC (permalink / raw)
To: korantwork, dlemoal, helgaas, kbusch, jonathan.derrick, lpieralisi
Cc: linux-pci, linux-kernel, Xinghui Li, Dan Carpenter
On 4/20/2023 2:43 AM, 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.
>
> Fixes: 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Xinghui Li <korantli@tencent.com>
> ---
> drivers/pci/controller/vmd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 990630ec57c6..1a36e9a52b93 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -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;
Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch
2023-04-20 9:43 [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch korantwork
2023-04-20 9:43 ` [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error " korantwork
2023-04-20 9:43 ` [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn " korantwork
@ 2023-06-24 16:33 ` Krzysztof Wilczyński
2023-06-25 3:14 ` Xinghui Li
2 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-06-24 16:33 UTC (permalink / raw)
To: korantwork
Cc: dlemoal, helgaas, nirmal.patel, kbusch, jonathan.derrick,
lpieralisi, linux-pci, linux-kernel, Xinghui Li,
Christoph Hellwig
[+CC Christoph]
Hello,
> 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
> 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/20221115054847.77829-1-jiapeng.chong@linux.alibaba.com/
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch
2023-06-24 16:33 ` [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD " Krzysztof Wilczyński
@ 2023-06-25 3:14 ` Xinghui Li
2023-06-25 17:03 ` Krzysztof Wilczyński
0 siblings, 1 reply; 8+ messages in thread
From: Xinghui Li @ 2023-06-25 3:14 UTC (permalink / raw)
To: Krzysztof Wilczyński
Cc: dlemoal, helgaas, nirmal.patel, kbusch, jonathan.derrick,
lpieralisi, linux-pci, linux-kernel, Xinghui Li,
Christoph Hellwig
On Sun, Jun 25, 2023 at 12:33 AM Krzysztof Wilczyński <kw@linux.com> wrote:
>
> [1/1] PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()
> https://git.kernel.org/pci/pci/c/0c0206dc4f5b
>
> > 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/20221115054847.77829-1-jiapeng.chong@linux.alibaba.com/
I think Christoph Hellwig's suggestion is indeed better.
So, should I submit a new patch to address this issue?
Thanks~
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch
2023-06-25 3:14 ` Xinghui Li
@ 2023-06-25 17:03 ` Krzysztof Wilczyński
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-06-25 17:03 UTC (permalink / raw)
To: Xinghui Li
Cc: dlemoal, helgaas, nirmal.patel, kbusch, jonathan.derrick,
lpieralisi, linux-pci, linux-kernel, Xinghui Li,
Christoph Hellwig
Hello,
> > > 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/20221115054847.77829-1-jiapeng.chong@linux.alibaba.com/
>
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-25 17:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 9:43 [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD reported by Smatch korantwork
2023-04-20 9:43 ` [PATCH v2 1/2] PCI: vmd: Fix one uninitialized symbol error " korantwork
2023-04-20 23:59 ` Patel, Nirmal
2023-04-20 9:43 ` [PATCH v2 2/2] PCI: vmd: Clean up one inconsistent indenting warn " korantwork
2023-04-20 23:59 ` Patel, Nirmal
2023-06-24 16:33 ` [PATCH v2 0/2] PCI: vmd: Fix two issues in VMD " Krzysztof Wilczyński
2023-06-25 3:14 ` Xinghui Li
2023-06-25 17:03 ` Krzysztof Wilczyński
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).