Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1249437

[PATCH 3/9 V2] usb/host/fotg210: Remove return statement inside if

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Peter Senna Tschudin <peter.senna@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 3/9 V2] usb/host/fotg210: Remove return statement inside if
Date Sat, 17 Oct 2015 21:40:02 +0200
Message-ID <qkFuG-77M-37@gated-at.bofh.it> (permalink)
References <qiTs5-3JD-1@gated-at.bofh.it>
X-Original-To gregkh@linuxfoundation.org, sergei.shtylyov@cogentembedded.com, jkosina@suse.cz, rdunlap@infradead.org, balbi@ti.com, standby24x7@gmail.com, chris@rorvick.com, stern@rowland.harvard.edu, john453@faraday-tech.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, joe@perches.com
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M2zurXI+1eDLHjtObNLtCu7fQ5CQbtTBYsZlmc8eawE=; b=oO4pscWH5jUosz9qB+9/My/r7+UAwyB9zBS5zd0KZ1YmI8qSJ0ueAIrQN9+P5Zb9cO 3pqmeNiLSzQFs6RmgEAzJR8gBSCSGwhkPm8QKjOqUyx5hqXMdbbzii7vM/Ik621pKY3A InkZhjcRN/LDuUo4XlgUnwe2MHUjsh6Ria51sz9AnKiHfpVL4o0+BhueCkgOoZGN2GBb ragvOGvcdtMwiGwRGWodZIrJAl4w+DbaD0NEVqOSvROe7ImOyjNNgP5ijSQOwmJ0/0j7 dgHleBIy8EHOLIUQyStTcIabb9TJhmQlMcznGdz+yEekQvizPYobUzBwr0KsgP2jXJH1 geNQ==
X-Received by 10.180.207.235 with SMTP id lz11mr12184597wic.1.1445110201369; Sat, 17 Oct 2015 12:30:01 -0700 (PDT)
X-Mailer git-send-email 2.1.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 50
Organization linux.* mail to news gateway
X-Original-Cc Peter Senna Tschudin <peter.senna@gmail.com>
X-Original-Date Sat, 17 Oct 2015 21:28:45 +0200
X-Original-Message-ID <1445110125-2916-1-git-send-email-peter.senna@gmail.com>
X-Original-References <1444687617.9184.4.camel@perches.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1249437

Show key headers only | View raw


This patch make changes to an if else statement which simplifies the code
allowing to remove a return.

CC: Joe Perches <joe@perches.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Subject was: [PATCH 3/9] usb/host/fotg210: Remove useless else statement

To be applied on top of V1.

Changes from V1:
   Instead of just removing the else statement, remove the return inside
   the if statement so the code is even more readable.

 drivers/usb/host/fotg210-hcd.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 7f6aa99..064cd85 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -1396,15 +1396,13 @@ static int check_reset_complete(struct fotg210_hcd *fotg210, int index,
 		return port_status;
 
 	/* if reset finished and it's still not enabled -- handoff */
-	if (!(port_status & PORT_PE)) {
+	if (!(port_status & PORT_PE))
 		/* with integrated TT, there's nobody to hand it to! */
-		fotg210_dbg(fotg210,
-				"Failed to enable port %d on root hub TT\n",
+		fotg210_dbg(fotg210, "Failed to enable port %d on root hub TT\n",
+				index + 1);
+	else
+		fotg210_dbg(fotg210, "port %d reset complete, port enabled\n",
 				index + 1);
-		return port_status;
-	}
-	fotg210_dbg(fotg210, "port %d reset complete, port enabled\n",
-			index + 1);
 
 	return port_status;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] usb/host/fotg210: code style and warning fixes Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 6/9] usb/host/fotg210: replace msleep by usleep_range Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 4/9] usb/host/fotg210: Remove NULL checks dma_pool_destroy Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 8/9] usb/host/fotg210: Add function: output_buf_tds_dir() Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 3/9] usb/host/fotg210: Remove useless else statement Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
    Re: [PATCH 3/9] usb/host/fotg210: Remove useless else statement Joe Perches <joe@perches.com> - 2015-10-13 00:10 +0200
      [PATCH 3/9 V2] usb/host/fotg210: Remove return statement inside if Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-17 21:40 +0200
  [PATCH 2/9] usb/host/fotg210: remove KERN_WARNING from pr_warn Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 7/9] usb/host/fotg210: convert macro to inline function Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 9/9] usb/host/fotg210: Add function scan_frame_queue() Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200
  [PATCH 5/9] usb/host/fotg210: change kmalloc by kmalloc_array Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-12 23:30 +0200

csiph-web