All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: legacy: compress return logic into one line
@ 2017-07-10  2:43 Gustavo A. R. Silva
  0 siblings, 0 replies; only message in thread
From: Gustavo A. R. Silva @ 2017-07-10  2:43 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Gustavo A. R. Silva

Simplify return logic to avoid unnecessary variable assignments.

These issues were 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/legacy/audio.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c
index 1f5cdbe..c02f95e 100644
--- a/drivers/usb/gadget/legacy/audio.c
+++ b/drivers/usb/gadget/legacy/audio.c
@@ -200,10 +200,8 @@ static int audio_do_config(struct usb_configuration *c)
 
 #ifdef CONFIG_GADGET_UAC1
 	f_uac1 = usb_get_function(fi_uac1);
-	if (IS_ERR(f_uac1)) {
-		status = PTR_ERR(f_uac1);
-		return status;
-	}
+	if (IS_ERR(f_uac1))
+		return PTR_ERR(f_uac1);
 
 	status = usb_add_function(c, f_uac1);
 	if (status < 0) {
@@ -212,10 +210,8 @@ static int audio_do_config(struct usb_configuration *c)
 	}
 #else
 	f_uac2 = usb_get_function(fi_uac2);
-	if (IS_ERR(f_uac2)) {
-		status = PTR_ERR(f_uac2);
-		return status;
-	}
+	if (IS_ERR(f_uac2))
+		return PTR_ERR(f_uac2);
 
 	status = usb_add_function(c, f_uac2);
 	if (status < 0) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-10  2:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10  2:43 [PATCH] usb: gadget: legacy: compress return logic into one line Gustavo A. R. Silva

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.