linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv1 1/3] Bluetooth: btmrvl: Correct num_block name
@ 2012-09-27  7:51 Andrei Emeltchenko
  2012-09-27  7:51 ` [PATCHv1 2/3] Bluetooth: btmrvl: Use DIV_ROUND_UP macro Andrei Emeltchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andrei Emeltchenko @ 2012-09-27  7:51 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Make code readable by correcting name from buf_block_len to num_blocks
since it represent number of blocks; NOT a length of a block buffer.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 drivers/bluetooth/btmrvl_sdio.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index da4df9c..25dc53b 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -492,7 +492,7 @@ done:
 static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
 {
 	u16 buf_len = 0;
-	int ret, buf_block_len, blksz;
+	int ret, num_blocks, blksz;
 	struct sk_buff *skb = NULL;
 	u32 type;
 	u8 *payload = NULL;
@@ -516,18 +516,17 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
 	BT_DBG("%s buf_len %zu", hdev->name, buf_len);
 
 	blksz = SDIO_BLOCK_SIZE;
-	buf_block_len = (buf_len + blksz - 1) / blksz;
+	num_blocks = (buf_len + blksz - 1) / blksz;
 
 	if (buf_len <= SDIO_HEADER_LEN
-			|| (buf_block_len * blksz) > ALLOC_BUF_SIZE) {
+	    || (num_blocks * blksz) > ALLOC_BUF_SIZE) {
 		BT_ERR("invalid packet length: %d", buf_len);
 		ret = -EINVAL;
 		goto exit;
 	}
 
 	/* Allocate buffer */
-	skb = bt_skb_alloc(buf_block_len * blksz + BTSDIO_DMA_ALIGN,
-								GFP_ATOMIC);
+	skb = bt_skb_alloc(num_blocks * blksz + BTSDIO_DMA_ALIGN, GFP_ATOMIC);
 	if (skb == NULL) {
 		BT_ERR("No free skb");
 		goto exit;
@@ -543,7 +542,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
 	payload = skb->data;
 
 	ret = sdio_readsb(card->func, payload, card->ioport,
-			  buf_block_len * blksz);
+			  num_blocks * blksz);
 	if (ret < 0) {
 		BT_ERR("readsb failed: %d", ret);
 		ret = -EIO;
@@ -594,7 +593,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
 	default:
 		BT_ERR("Unknown packet type:%d", type);
 		print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, payload,
-						blksz * buf_block_len);
+				     blksz * num_blocks);
 
 		kfree_skb(skb);
 		skb = NULL;
-- 
1.7.9.5


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

end of thread, other threads:[~2012-09-28 19:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27  7:51 [PATCHv1 1/3] Bluetooth: btmrvl: Correct num_block name Andrei Emeltchenko
2012-09-27  7:51 ` [PATCHv1 2/3] Bluetooth: btmrvl: Use DIV_ROUND_UP macro Andrei Emeltchenko
2012-09-27  7:51 ` [PATCHv1 3/3] Bluetooth: btmrvl: Fix skb buffer overflow Andrei Emeltchenko
2012-09-27 20:51   ` Gustavo Padovan
2012-09-28 11:36     ` [PATCH 1/3] Bluetooth: btmrvl: Correct num_block name Andrei Emeltchenko
2012-09-28 11:36       ` [PATCH 2/3] Bluetooth: btmrvl: Use DIV_ROUND_UP macro Andrei Emeltchenko
2012-09-28 11:36       ` [PATCH 3/3] Bluetooth: btmrvl: Fix skb buffer overflow Andrei Emeltchenko
2012-09-28 19:52         ` Gustavo Padovan
2012-09-27 20:48 ` [PATCHv1 1/3] Bluetooth: btmrvl: Correct num_block name Gustavo Padovan

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).