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]
Date:	Fri, 01 Jun 2012 18:02:07 -0400
From:	Don Dutile <ddutile@...hat.com>
To:	Myron Stowe <myron.stowe@...hat.com>
CC:	bhelgaas@...gle.com, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org, xudong.hao@...ux.intel.com,
	yu.zhao@...el.com
Subject: Re: [PATCH 2/4] PCI: Remove redundant checking in PCI Express capability
 routines

On 06/01/2012 05:16 PM, Myron Stowe wrote:
> There are a number of redundant pci_is_pcie() checks in various PCI
> Express capabilities related routines like the following:
>
>      if (!pci_is_pcie(dev))
> 	return false;
>
>      pos = pci_pcie_cap(dev);
>      if (!pos)
> 	return false;
>
> The current pci_is_pcie() implementation is merely:
>
>      static inline bool pci_is_pcie(struct pci_dev *dev)
>      {
>          return !!pci_pcie_cap(dev);
>      }
>
> so we can just drop the pci_is_pcie() test in such cases.
>
> Suggested by Bjorn Helgaas in -
> http://marc.info/?l=linux-pci&m=130463494319762&w=2
>
> Signed-off-by: Myron Stowe<myron.stowe@...hat.com>
> ---
>
you can add my ack to this patch.

>   drivers/pci/pci.c |   14 +-------------
>   1 files changed, 1 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 64471b1..ff0beb0 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1995,7 +1995,7 @@ void pci_enable_ari(struct pci_dev *dev)
>   		return;
>
>   	bridge = dev->bus->self;
> -	if (!bridge || !pci_is_pcie(bridge))
> +	if (!bridge)
>   		return;
>
>   	pos = pci_pcie_cap(bridge);
> @@ -2055,9 +2055,6 @@ void pci_disable_ido(struct pci_dev *dev, unsigned long type)
>   	int pos;
>   	u16 ctrl;
>
> -	if (!pci_is_pcie(dev))
> -		return;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return;
> @@ -2097,9 +2094,6 @@ int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type type)
>   	u16 ctrl;
>   	int ret;
>
> -	if (!pci_is_pcie(dev))
> -		return -ENOTSUPP;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return -ENOTSUPP;
> @@ -2150,9 +2144,6 @@ void pci_disable_obff(struct pci_dev *dev)
>   	int pos;
>   	u16 ctrl;
>
> -	if (!pci_is_pcie(dev))
> -		return;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return;
> @@ -2175,9 +2166,6 @@ static bool pci_ltr_supported(struct pci_dev *dev)
>   	int pos;
>   	u32 cap;
>
> -	if (!pci_is_pcie(dev))
> -		return false;
> -
>   	pos = pci_pcie_cap(dev);
>   	if (!pos)
>   		return false;
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ