* [PATCH v2] PCI: remove an unnecessary if condition before a return statement
@ 2014-11-07 8:06 Quentin Lambert
2014-11-07 15:40 ` Srikanth Thokala
2014-11-11 4:13 ` Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Quentin Lambert @ 2014-11-07 8:06 UTC (permalink / raw)
To: bhelgaas; +Cc: linux-pci, linux-kernel, julia.lawall, fengguang.wu
Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
Changes in v2:
- remove a checkpatch warning due to the a space between after the
function name.
drivers/pci/hotplug/ibmphp_res.c | 5 +----
drivers/pci/pci.c | 6 +-----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index 219ba80..2da59ef 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void)
if (rc)
return rc;
}
- rc = once_over (); /* This is to align ranges (so no -1) */
- if (rc)
- return rc;
- return 0;
+ return once_over();
}
/********************************************************************************
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 625a4ac..9a5871f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev)
if (i != 0)
return i;
- i = pci_save_vc_state(dev);
- if (i != 0)
- return i;
-
- return 0;
+ return pci_save_vc_state(dev);
}
EXPORT_SYMBOL(pci_save_state);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] PCI: remove an unnecessary if condition before a return statement
2014-11-07 8:06 [PATCH v2] PCI: remove an unnecessary if condition before a return statement Quentin Lambert
@ 2014-11-07 15:40 ` Srikanth Thokala
2014-11-11 4:13 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Srikanth Thokala @ 2014-11-07 15:40 UTC (permalink / raw)
To: Quentin Lambert
Cc: Bjorn Helgaas, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, julia.lawall, fengguang.wu
Hi Quentin,
On Fri, Nov 7, 2014 at 1:36 PM, Quentin Lambert
<lambert.quentin@gmail.com> wrote:
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
> ---
>
> Changes in v2:
> - remove a checkpatch warning due to the a space between after the
> function name.
>
> drivers/pci/hotplug/ibmphp_res.c | 5 +----
> drivers/pci/pci.c | 6 +-----
> 2 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
> index 219ba80..2da59ef 100644
> --- a/drivers/pci/hotplug/ibmphp_res.c
> +++ b/drivers/pci/hotplug/ibmphp_res.c
> @@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void)
> if (rc)
> return rc;
> }
> - rc = once_over (); /* This is to align ranges (so no -1) */
> - if (rc)
> - return rc;
> - return 0;
> + return once_over();
I think we need to retain the comment?
- Srikanth
> }
>
> /********************************************************************************
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 625a4ac..9a5871f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev)
> if (i != 0)
> return i;
>
> - i = pci_save_vc_state(dev);
> - if (i != 0)
> - return i;
> -
> - return 0;
> + return pci_save_vc_state(dev);
> }
> EXPORT_SYMBOL(pci_save_state);
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] PCI: remove an unnecessary if condition before a return statement
2014-11-07 8:06 [PATCH v2] PCI: remove an unnecessary if condition before a return statement Quentin Lambert
2014-11-07 15:40 ` Srikanth Thokala
@ 2014-11-11 4:13 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2014-11-11 4:13 UTC (permalink / raw)
To: Quentin Lambert
Cc: linux-pci, linux-kernel, julia.lawall, fengguang.wu,
Srikanth Thokala
[+cc Srikanth]
On Fri, Nov 07, 2014 at 09:06:39AM +0100, Quentin Lambert wrote:
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Applied to pci/misc for v3.19, thanks!
I have no idea what it means, but I did add back the comment as Srikanth
pointed out.
> ---
>
> Changes in v2:
> - remove a checkpatch warning due to the a space between after the
> function name.
>
> drivers/pci/hotplug/ibmphp_res.c | 5 +----
> drivers/pci/pci.c | 6 +-----
> 2 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
> index 219ba80..2da59ef 100644
> --- a/drivers/pci/hotplug/ibmphp_res.c
> +++ b/drivers/pci/hotplug/ibmphp_res.c
> @@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void)
> if (rc)
> return rc;
> }
> - rc = once_over (); /* This is to align ranges (so no -1) */
> - if (rc)
> - return rc;
> - return 0;
> + return once_over();
> }
>
> /********************************************************************************
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 625a4ac..9a5871f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev)
> if (i != 0)
> return i;
>
> - i = pci_save_vc_state(dev);
> - if (i != 0)
> - return i;
> -
> - return 0;
> + return pci_save_vc_state(dev);
> }
> EXPORT_SYMBOL(pci_save_state);
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-11 4:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 8:06 [PATCH v2] PCI: remove an unnecessary if condition before a return statement Quentin Lambert
2014-11-07 15:40 ` Srikanth Thokala
2014-11-11 4:13 ` 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).