xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: kernel-janitors@vger.kernel.org, trivial@kernel.org,
	linux-pci@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	David Vrabel <david.vrabel@citrix.com>,
	xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Coccinelle <cocci@systeme.lip6.fr>, Len Brown <lenb@kernel.org>
Subject: Re: [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls
Date: Mon, 10 Nov 2014 21:07:17 -0700	[thread overview]
Message-ID: <20141111040717.GD28161__26665.2299011641$1415678964$gmane$org@google.com> (raw)
In-Reply-To: <545649DE.80304@users.sourceforge.net>

On Sun, Nov 02, 2014 at 04:12:30PM +0100, SF Markus Elfring wrote:
> The functions pci_dev_put(), pci_pme_wakeup_bus() and put_device() test
> whether their argument is NULL and then return immediately. Thus the test
> around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Applied to pci/misc for v3.19, thanks!

> ---
>  drivers/pci/pci-acpi.c     | 3 +--
>  drivers/pci/probe.c        | 3 +--
>  drivers/pci/search.c       | 3 +--
>  drivers/pci/xen-pcifront.c | 3 +--
>  4 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 37263b0..a8fe5de 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -60,8 +60,7 @@ static void pci_acpi_wake_dev(struct work_struct *work)
>  	pci_wakeup_event(pci_dev);
>  	pm_runtime_resume(&pci_dev->dev);
> 
> -	if (pci_dev->subordinate)
> -		pci_pme_wakeup_bus(pci_dev->subordinate);
> +	pci_pme_wakeup_bus(pci_dev->subordinate);
>  }
> 
>  /**
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 4170113..e93f16e 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -86,8 +86,7 @@ static void release_pcibus_dev(struct device *dev)
>  {
>  	struct pci_bus *pci_bus = to_pci_bus(dev);
> 
> -	if (pci_bus->bridge)
> -		put_device(pci_bus->bridge);
> +	put_device(pci_bus->bridge);
>  	pci_bus_remove_resources(pci_bus);
>  	pci_release_bus_of_node(pci_bus);
>  	kfree(pci_bus);
> diff --git a/drivers/pci/search.c b/drivers/pci/search.c
> index 827ad83..2d806bd 100644
> --- a/drivers/pci/search.c
> +++ b/drivers/pci/search.c
> @@ -305,8 +305,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct
> pci_device_id *id,
>  			      match_pci_dev_by_id);
>  	if (dev)
>  		pdev = to_pci_dev(dev);
> -	if (from)
> -		pci_dev_put(from);
> +	pci_dev_put(from);
>  	return pdev;
>  }
> 
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 53df39a..46664cc 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -596,8 +596,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
>  	pcidev = pci_get_bus_and_slot(bus, devfn);
>  	if (!pcidev || !pcidev->driver) {
>  		dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
> -		if (pcidev)
> -			pci_dev_put(pcidev);
> +		pci_dev_put(pcidev);
>  		return result;
>  	}
>  	pdrv = pcidev->driver;
> -- 
> 2.1.3
> 
> 

  parent reply	other threads:[~2014-11-11  4:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.sourceforge.net>
2014-11-02 15:12                                 ` [PATCH 1/1] PCI: Deletion of unnecessary checks before three function calls SF Markus Elfring
     [not found]                                 ` <545649DE.80304@users.sourceforge.net>
2014-11-11  4:07                                   ` Bjorn Helgaas [this message]
2016-07-16 20:20                                 ` [PATCH 0/3] xen-scsiback: Fine-tuning for scsiback_device_action() SF Markus Elfring
     [not found]                                 ` <59e51c7d-f7bb-c55f-d2fe-06dccfef6a99@users.sourceforge.net>
2016-07-16 20:22                                   ` [PATCH 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2016-07-16 20:23                                   ` [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection SF Markus Elfring
2016-07-16 20:24                                   ` [PATCH 3/3] xen-scsiback: Pass a failure indication as a constant SF Markus Elfring
     [not found]                                   ` <fa839c03-b076-0264-c363-5581d0298632@users.sourceforge.net>
2016-07-18  5:01                                     ` [PATCH 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" Juergen Gross
     [not found]                                   ` <e447cf62-ffc7-4b82-cff2-947c8874756a@users.sourceforge.net>
2016-07-18  5:05                                     ` [PATCH 3/3] xen-scsiback: Pass a failure indication as a constant Juergen Gross
     [not found]                                   ` <87e55a72-71ad-d0a1-b936-12565bbc6508@users.sourceforge.net>
2016-07-18  5:11                                     ` [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection Juergen Gross
     [not found]                                     ` <fb5824ad-fb09-e471-7dc4-3e32564cc334@suse.com>
2016-07-19 14:56                                       ` SF Markus Elfring
2016-07-20  4:35                                         ` Juergen Gross
     [not found]                                         ` <83b0b1e2-900b-eefc-160b-7d837730571c@suse.com>
2016-07-20  5:10                                           ` SF Markus Elfring
2016-07-20  5:26                                             ` Juergen Gross
     [not found]                                             ` <85b948e0-bf37-dff0-6792-77b5dacef9a0@suse.com>
2016-07-20 11:27                                               ` [PATCH v2 0/3] xen-scsiback: Fine-tuning for scsiback_device_action() SF Markus Elfring
2016-07-20 11:30                                                 ` [PATCH v2 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2016-07-20 11:44                                                   ` Juergen Gross
2016-07-20 11:34                                                 ` [PATCH v2 2/3] xen-scsiback: Rename jump labels in scsiback_device_action() SF Markus Elfring
2016-07-20 11:45                                                   ` Juergen Gross
2016-07-20 11:36                                                 ` [PATCH v2 3/3] xen-scsiback: Pass a failure indication as a constant SF Markus Elfring
2016-07-20 11:44                                                   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20141111040717.GD28161__26665.2299011641$1415678964$gmane$org@google.com' \
    --to=bhelgaas@google.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=david.vrabel@citrix.com \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=trivial@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).