From: "Devin J. Pohly" <djpohly@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, "Devin J. Pohly" <djpohly@gmail.com>
Subject: [PATCH 5/9] mei: remove indentation where else follows return
Date: Thu, 23 Feb 2012 20:38:52 -0500 [thread overview]
Message-ID: <1330047536-3827-6-git-send-email-djpohly@gmail.com> (raw)
In-Reply-To: <1330047536-3827-1-git-send-email-djpohly@gmail.com>
From: "Devin J. Pohly" <djpohly@gmail.com>
If a function returns early as the last statement of an if block, the
"else" is pretty much implied.
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
---
drivers/staging/mei/interrupt.c | 58 ++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/mei/interrupt.c b/drivers/staging/mei/interrupt.c
index b024270..ade5574 100644
--- a/drivers/staging/mei/interrupt.c
+++ b/drivers/staging/mei/interrupt.c
@@ -945,14 +945,13 @@ static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots,
list_move_tail(&cb_pos->cb_list,
&cmpl_list->mei_cb.cb_list);
return -ENODEV;
- } else {
- if (mei_flow_ctrl_reduce(dev, cl))
- return -ENODEV;
- cl->status = 0;
- cb_pos->information += mei_hdr->length;
- list_move_tail(&cb_pos->cb_list,
- &dev->write_waiting_list.mei_cb.cb_list);
}
+ if (mei_flow_ctrl_reduce(dev, cl))
+ return -ENODEV;
+ cl->status = 0;
+ cb_pos->information += mei_hdr->length;
+ list_move_tail(&cb_pos->cb_list,
+ &dev->write_waiting_list.mei_cb.cb_list);
} else if (*slots == ((dev->host_hw_state & H_CBD) >> 24)) {
/* buffer is still empty */
mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
@@ -973,18 +972,17 @@ static int _mei_irq_thread_cmpl(struct mei_device *dev, s32 *slots,
list_move_tail(&cb_pos->cb_list,
&cmpl_list->mei_cb.cb_list);
return -ENODEV;
- } else {
- cb_pos->information += mei_hdr->length;
- dev_dbg(&dev->pdev->dev,
- "cb_pos->request_buffer.size =%d"
- " mei_hdr->msg_complete = %d\n",
- cb_pos->request_buffer.size,
- mei_hdr->msg_complete);
- dev_dbg(&dev->pdev->dev, "cb_pos->information =%lu\n",
- cb_pos->information);
- dev_dbg(&dev->pdev->dev, "mei_hdr->length =%d\n",
- mei_hdr->length);
}
+ cb_pos->information += mei_hdr->length;
+ dev_dbg(&dev->pdev->dev,
+ "cb_pos->request_buffer.size =%d"
+ " mei_hdr->msg_complete = %d\n",
+ cb_pos->request_buffer.size,
+ mei_hdr->msg_complete);
+ dev_dbg(&dev->pdev->dev, "cb_pos->information =%lu\n",
+ cb_pos->information);
+ dev_dbg(&dev->pdev->dev, "mei_hdr->length =%d\n",
+ mei_hdr->length);
return -EMSGSIZE;
} else {
return -EBADMSG;
@@ -1033,20 +1031,18 @@ static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots,
cl->status = -ENODEV;
list_del(&cb_pos->cb_list);
return -ENODEV;
- } else {
- if (mei_flow_ctrl_reduce(dev, cl))
- return -ENODEV;
- dev->iamthif_msg_buf_index += mei_hdr->length;
- cb_pos->information = dev->iamthif_msg_buf_index;
- cl->status = 0;
- dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
- dev->iamthif_flow_control_pending = true;
- /* save iamthif cb sent to amthi client */
- dev->iamthif_current_cb = cb_pos;
- list_move_tail(&cb_pos->cb_list,
- &dev->write_waiting_list.mei_cb.cb_list);
-
}
+ if (mei_flow_ctrl_reduce(dev, cl))
+ return -ENODEV;
+ dev->iamthif_msg_buf_index += mei_hdr->length;
+ cb_pos->information = dev->iamthif_msg_buf_index;
+ cl->status = 0;
+ dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
+ dev->iamthif_flow_control_pending = true;
+ /* save iamthif cb sent to amthi client */
+ dev->iamthif_current_cb = cb_pos;
+ list_move_tail(&cb_pos->cb_list,
+ &dev->write_waiting_list.mei_cb.cb_list);
} else if (*slots == ((dev->host_hw_state & H_CBD) >> 24)) {
/* buffer is still empty */
mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0];
--
1.7.9.2
next prev parent reply other threads:[~2012-02-24 1:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 1:38 Devin J. Pohly
2012-02-24 1:38 ` [PATCH 1/9] mei: cosmetic cleanup in interrupt.c Devin J. Pohly
2012-02-24 2:51 ` Greg KH
2012-02-24 1:38 ` [PATCH 2/9] mei: factor some bits of code outside if blocks Devin J. Pohly
2012-02-24 1:38 ` [PATCH 3/9] mei: more idiomatic variable/label usage Devin J. Pohly
2012-02-24 1:38 ` [PATCH 4/9] mei: return values are -Exxx, not ~Exxx! Devin J. Pohly
2012-02-27 16:35 ` Tomas Winkler
2012-02-24 1:38 ` Devin J. Pohly [this message]
2012-02-24 1:38 ` [PATCH 6/9] mei: reduce indentation with early returns Devin J. Pohly
2012-02-24 1:38 ` [PATCH 7/9] mei: reduce indentation by combining if blocks Devin J. Pohly
2012-02-24 1:38 ` [PATCH 8/9] mei: reduce indentation in read_client_message Devin J. Pohly
2012-02-24 1:38 ` [PATCH 9/9] mei: reduce indentation in read_bus_message Devin J. Pohly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330047536-3827-6-git-send-email-djpohly@gmail.com \
--to=djpohly@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).