Re: [PATCH] PCI: PCIe: Fix uninitialized variable 'cap_mask'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 9 Apr 2012 11:08:48 +0800
Chunhe Lan <b25806@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx>
> > ---
> >  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: signature.asc
Description: PGP signature


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux