All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: udc-xilinx: compress return logic into one line
@ 2017-07-10  3:04 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-07-10  3:04 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Michal Simek, Sören Brinkmann
  Cc: linux-usb, linux-arm-kernel, linux-kernel, Gustavo A. R. Silva

Simplify return logic to avoid unnecessary variable assignment.

This issue was detected using Coccinelle and the following
semantic patch:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/usb/gadget/udc/udc-xilinx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
index de207a9..552389d 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -1217,14 +1217,13 @@ static const struct usb_ep_ops xusb_ep_ops = {
 static int xudc_get_frame(struct usb_gadget *gadget)
 {
 	struct xusb_udc *udc;
-	int frame;
 
 	if (!gadget)
 		return -ENODEV;
 
 	udc = to_udc(gadget);
-	frame = udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
-	return frame;
+
+	return udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
 }
 
 /**
-- 
2.5.0

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

* [PATCH] usb: gadget: udc-xilinx: compress return logic into one line
@ 2017-07-10  3:04 ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-07-10  3:04 UTC (permalink / raw)
  To: linux-arm-kernel

Simplify return logic to avoid unnecessary variable assignment.

This issue was detected using Coccinelle and the following
semantic patch:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/usb/gadget/udc/udc-xilinx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
index de207a9..552389d 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -1217,14 +1217,13 @@ static const struct usb_ep_ops xusb_ep_ops = {
 static int xudc_get_frame(struct usb_gadget *gadget)
 {
 	struct xusb_udc *udc;
-	int frame;
 
 	if (!gadget)
 		return -ENODEV;
 
 	udc = to_udc(gadget);
-	frame = udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
-	return frame;
+
+	return udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
 }
 
 /**
-- 
2.5.0

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

* Re: [PATCH] usb: gadget: udc-xilinx: compress return logic into one line
  2017-07-10  3:04 ` Gustavo A. R. Silva
@ 2017-07-10  6:32   ` Michal Simek
  -1 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2017-07-10  6:32 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Felipe Balbi, Greg Kroah-Hartman,
	Michal Simek, Sören Brinkmann
  Cc: linux-usb, linux-arm-kernel, linux-kernel

On 10.7.2017 05:04, Gustavo A. R. Silva wrote:
> Simplify return logic to avoid unnecessary variable assignment.
> 
> This issue was detected using Coccinelle and the following
> semantic patch:
> 
> @@
> local idexpression ret;
> expression e;
> @@
> 
> -ret =
> +return
>      e;
> -return ret;
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/usb/gadget/udc/udc-xilinx.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
> index de207a9..552389d 100644
> --- a/drivers/usb/gadget/udc/udc-xilinx.c
> +++ b/drivers/usb/gadget/udc/udc-xilinx.c
> @@ -1217,14 +1217,13 @@ static const struct usb_ep_ops xusb_ep_ops = {
>  static int xudc_get_frame(struct usb_gadget *gadget)
>  {
>  	struct xusb_udc *udc;
> -	int frame;
>  
>  	if (!gadget)
>  		return -ENODEV;
>  
>  	udc = to_udc(gadget);
> -	frame = udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
> -	return frame;
> +
> +	return udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
>  }
>  
>  /**
> 

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

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

* [PATCH] usb: gadget: udc-xilinx: compress return logic into one line
@ 2017-07-10  6:32   ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2017-07-10  6:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 10.7.2017 05:04, Gustavo A. R. Silva wrote:
> Simplify return logic to avoid unnecessary variable assignment.
> 
> This issue was detected using Coccinelle and the following
> semantic patch:
> 
> @@
> local idexpression ret;
> expression e;
> @@
> 
> -ret =
> +return
>      e;
> -return ret;
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/usb/gadget/udc/udc-xilinx.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
> index de207a9..552389d 100644
> --- a/drivers/usb/gadget/udc/udc-xilinx.c
> +++ b/drivers/usb/gadget/udc/udc-xilinx.c
> @@ -1217,14 +1217,13 @@ static const struct usb_ep_ops xusb_ep_ops = {
>  static int xudc_get_frame(struct usb_gadget *gadget)
>  {
>  	struct xusb_udc *udc;
> -	int frame;
>  
>  	if (!gadget)
>  		return -ENODEV;
>  
>  	udc = to_udc(gadget);
> -	frame = udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
> -	return frame;
> +
> +	return udc->read_fn(udc->addr + XUSB_FRAMENUM_OFFSET);
>  }
>  
>  /**
> 

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

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

end of thread, other threads:[~2017-07-10  6:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10  3:04 [PATCH] usb: gadget: udc-xilinx: compress return logic into one line Gustavo A. R. Silva
2017-07-10  3:04 ` Gustavo A. R. Silva
2017-07-10  6:32 ` Michal Simek
2017-07-10  6:32   ` Michal Simek

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.