All of lore.kernel.org
 help / color / mirror / Atom feed
* [Outreachy kernel][PATCH] staging: mt7621-pci: PTR_ERR_OR_ZERO can be used
@ 2018-10-22  7:00 Bhanusree Pola
  2018-10-22  7:04 ` Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Bhanusree Pola @ 2018-10-22  7:00 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh, bhanusreemahesh

Replace multiple return statements  with single return
Used the following script by coccinelle
	scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
index a49e279..bb08fd2 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -403,10 +403,7 @@ static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie)
 	}
 
 	pcie->base = devm_ioremap_resource(dev, &regs);
-	if (IS_ERR(pcie->base))
-		return PTR_ERR(pcie->base);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(pcie->base);
 }
 
 static int mt7621_pcie_request_resources(struct mt7621_pcie *pcie,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel][PATCH] staging: mt7621-pci: PTR_ERR_OR_ZERO can be used
  2018-10-22  7:00 [Outreachy kernel][PATCH] staging: mt7621-pci: PTR_ERR_OR_ZERO can be used Bhanusree Pola
@ 2018-10-22  7:04 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2018-10-22  7:04 UTC (permalink / raw)
  To: Bhanusree Pola; +Cc: outreachy-kernel, gregkh



On Mon, 22 Oct 2018, Bhanusree Pola wrote:

> Replace multiple return statements  with single return
> Used the following script by coccinelle
> 	scripts/coccinelle/api/ptr_ret.cocci
>
> Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
> ---
>  drivers/staging/mt7621-pci/pci-mt7621.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
> index a49e279..bb08fd2 100644
> --- a/drivers/staging/mt7621-pci/pci-mt7621.c
> +++ b/drivers/staging/mt7621-pci/pci-mt7621.c
> @@ -403,10 +403,7 @@ static int mt7621_pcie_parse_dt(struct mt7621_pcie *pcie)
>  	}
>
>  	pcie->base = devm_ioremap_resource(dev, &regs);
> -	if (IS_ERR(pcie->base))
> -		return PTR_ERR(pcie->base);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(pcie->base);

It might be considered to be unfavorable to make the change in this case,
because there is a previous if ... return, so using PTR_ERR_OR_ZERO breaks
the style.

julia

>  }
>
>  static int mt7621_pcie_request_resources(struct mt7621_pcie *pcie,
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20181022070014.GA7822%40aakashd-VirtualBox.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-22  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22  7:00 [Outreachy kernel][PATCH] staging: mt7621-pci: PTR_ERR_OR_ZERO can be used Bhanusree Pola
2018-10-22  7:04 ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.