* [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask'
@ 2012-03-07 7:16 Chunhe Lan
2012-04-09 3:08 ` Chunhe Lan
0 siblings, 1 reply; 4+ messages in thread
From: Chunhe Lan @ 2012-03-07 7:16 UTC (permalink / raw)
To: linux-pci; +Cc: jbarnes, Chunhe Lan
Get rid of these:
drivers/pci/pcie/portdrv_core.c: In function 'pcie_port_device_register':
drivers/pci/pcie/portdrv_core.c:275:16: warning: 'cap_mask' may be used
uninitialized in this function [-Wuninitialized]
drivers/pci/pcie/portdrv_core.c:240:6: note: 'cap_mask' was declared here
In some cases, 'cap_mask' may be not set in pcie_port_platform_notify,
holding a garbage value.
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
drivers/pci/pcie/portdrv_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 595654a..751b464 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -237,7 +237,7 @@ static int get_port_device_capability(struct pci_dev *dev)
int services = 0, pos;
u16 reg16;
u32 reg32;
- int cap_mask;
+ int cap_mask = 0;
int err;
if (pcie_ports_disabled)
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask'
2012-03-07 7:16 [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask' Chunhe Lan
@ 2012-04-09 3:08 ` Chunhe Lan
2012-04-09 15:16 ` Jesse Barnes
0 siblings, 1 reply; 4+ messages in thread
From: Chunhe Lan @ 2012-04-09 3:08 UTC (permalink / raw)
To: jbarnes; +Cc: linux-pci
Chunhe Lan wrote:
> Get rid of these:
>
> drivers/pci/pcie/portdrv_core.c: In function 'pcie_port_device_register':
> drivers/pci/pcie/portdrv_core.c:275:16: warning: 'cap_mask' may be used
> uninitialized in this function [-Wuninitialized]
> drivers/pci/pcie/portdrv_core.c:240:6: note: 'cap_mask' was declared here
>
> In some cases, 'cap_mask' may be not set in pcie_port_platform_notify,
> holding a garbage value.
>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
> drivers/pci/pcie/portdrv_core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
> index 595654a..751b464 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -237,7 +237,7 @@ static int get_port_device_capability(struct pci_dev *dev)
> int services = 0, pos;
> u16 reg16;
> u32 reg32;
> - int cap_mask;
> + int cap_mask = 0;
> int err;
>
> if (pcie_ports_disabled)
>
Hello Jesse Barnes,
Have you any comment about this patch?
It locates at http://article.gmane.org/gmane.linux.kernel.pci/14062
If it has not question, can you merge it to your git tree?
Thanks.
-Lan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask'
2012-04-09 3:08 ` Chunhe Lan
@ 2012-04-09 15:16 ` Jesse Barnes
[not found] ` <4F83D109.4000702@freescale.com>
0 siblings, 1 reply; 4+ messages in thread
From: Jesse Barnes @ 2012-04-09 15:16 UTC (permalink / raw)
To: Chunhe Lan; +Cc: linux-pci
[-- Attachment #1: Type: text/plain, Size: 1638 bytes --]
On Mon, 9 Apr 2012 11:08:48 +0800
Chunhe Lan <b25806@freescale.com> wrote:
>
>
> Chunhe Lan wrote:
> > Get rid of these:
> >
> > drivers/pci/pcie/portdrv_core.c: In function 'pcie_port_device_register':
> > drivers/pci/pcie/portdrv_core.c:275:16: warning: 'cap_mask' may be used
> > uninitialized in this function [-Wuninitialized]
> > drivers/pci/pcie/portdrv_core.c:240:6: note: 'cap_mask' was declared here
> >
> > In some cases, 'cap_mask' may be not set in pcie_port_platform_notify,
> > holding a garbage value.
> >
> > Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> > ---
> > drivers/pci/pcie/portdrv_core.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
> > index 595654a..751b464 100644
> > --- a/drivers/pci/pcie/portdrv_core.c
> > +++ b/drivers/pci/pcie/portdrv_core.c
> > @@ -237,7 +237,7 @@ static int get_port_device_capability(struct pci_dev *dev)
> > int services = 0, pos;
> > u16 reg16;
> > u32 reg32;
> > - int cap_mask;
> > + int cap_mask = 0;
> > int err;
> >
> > if (pcie_ports_disabled)
> >
> Hello Jesse Barnes,
>
> Have you any comment about this patch?
> It locates at http://article.gmane.org/gmane.linux.kernel.pci/14062
>
> If it has not question, can you merge it to your git tree?
Yeah patch looks fine, bounce it over to Bjorn if you want it applied.
I didn't check where it gets used though, and whether 0xffffffff would
be a better default mask value or not.
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask'
[not found] ` <4F83D109.4000702@freescale.com>
@ 2012-04-11 0:30 ` Bjorn Helgaas
0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2012-04-11 0:30 UTC (permalink / raw)
To: Chunhe Lan; +Cc: linux-pci, Jesse Barnes
On Tue, Apr 10, 2012 at 12:19 AM, Chunhe Lan <b25806@freescale.com> wrote:
>
>
> Jesse Barnes wrote:
>
> On Mon, 9 Apr 2012 11:08:48 +0800
> Chunhe Lan <b25806@freescale.com> wrote:
>
>
>
> Chunhe Lan wrote:
>
>
> Get rid of these:
>
> drivers/pci/pcie/portdrv_core.c: In function 'pcie_port_device_register':
> drivers/pci/pcie/portdrv_core.c:275:16: warning: 'cap_mask' may be used
> uninitialized in this function [-Wuninitialized]
> drivers/pci/pcie/portdrv_core.c:240:6: note: 'cap_mask' was declared here
>
> In some cases, 'cap_mask' may be not set in pcie_port_platform_notify,
> holding a garbage value.
>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
> drivers/pci/pcie/portdrv_core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/pcie/portdrv_core.c
> b/drivers/pci/pcie/portdrv_core.c
> index 595654a..751b464 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -237,7 +237,7 @@ static int get_port_device_capability(struct pci_dev
> *dev)
> int services = 0, pos;
> u16 reg16;
> u32 reg32;
> - int cap_mask;
> + int cap_mask = 0;
> int err;
>
> if (pcie_ports_disabled)
>
>
>
> Hello Jesse Barnes,
>
> Have you any comment about this patch?
> It locates at http://article.gmane.org/gmane.linux.kernel.pci/14062
>
> If it has not question, can you merge it to your git tree?
>
>
> Yeah patch looks fine, bounce it over to Bjorn if you want it applied.
>
> I didn't check where it gets used though, and whether 0xffffffff would
> be a better default mask value or not.
>
>
> I have tested it on the P5020DS board of PowerPC.
> When it is zero, ping is OK.
> When it is 0xffffffff, ping fails.
> So, that it is initialized to zero is right.
>
> Hello Bjorn,
>
>
> Have you any comment about this patch?
> If it has not question, could you merge it to your git tree?
This looks good to me. I'll try to merge it tonight.
I'm out of the office for the next two weeks, until April 23, so I
have pretty limited time until then.
Bjorn
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-11 0:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-07 7:16 [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask' Chunhe Lan
2012-04-09 3:08 ` Chunhe Lan
2012-04-09 15:16 ` Jesse Barnes
[not found] ` <4F83D109.4000702@freescale.com>
2012-04-11 0:30 ` Bjorn Helgaas
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).