lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <37D7C6CF3E00A74B8858931C1DB2F07712C27443@SHSMSX103.ccr.corp.intel.com>
Date:	Mon, 15 Aug 2016 14:12:41 +0000
From:	"Liang, Kan" <kan.liang@...el.com>
To:	Nilay Vaish <nilayvaish@...il.com>
CC:	"peterz@...radead.org" <peterz@...radead.org>,
	"tglx@...utronix.de" <tglx@...utronix.de>,
	"mingo@...hat.com" <mingo@...hat.com>,
	"Linux Kernel list" <linux-kernel@...r.kernel.org>,
	"eranian@...gle.com" <eranian@...gle.com>,
	Andi Kleen <andi@...stfloor.org>
Subject: RE: [PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore
 support



> > diff --git a/arch/x86/events/intel/uncore_snbep.c
> > b/arch/x86/events/intel/uncore_snbep.c
> > index 3719af5..55a081e 100644
> > --- a/arch/x86/events/intel/uncore_snbep.c
> > +++ b/arch/x86/events/intel/uncore_snbep.c
> > +
> > +static int skx_count_chabox(void)
> > +{
> > +       struct pci_dev *chabox_dev = NULL;
> > +       int bus, count = 0;
> > +
> > +       while (1) {
> > +               chabox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x208d,
> chabox_dev);
> > +               if (!chabox_dev)
> > +                       break;
> > +               if (count == 0)
> > +                       bus = chabox_dev->bus->number;
> > +               if (bus != chabox_dev->bus->number)
> > +                       break;
> > +               count++;
> > +       }
> > +
> > +       pci_dev_put(chabox_dev);
> > +       return count;
> > +}
> 
> Kan,  do we not need to call pci_dev_put() each time we call pci_get_device()?

The pci_get_device will always decrease the reference count for chabox_dev, if
it is not NULL.
So I think it's OK to only pci_dev_put it at last.

Thanks,
Kan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ