Commit 42632805 authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo Padovan

Bluetooth: btmrvl: Correct num_block name

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: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 13465c0a
...@@ -492,7 +492,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) ...@@ -492,7 +492,7 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card)
static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
{ {
u16 buf_len = 0; u16 buf_len = 0;
int ret, buf_block_len, blksz; int ret, num_blocks, blksz;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
u32 type; u32 type;
u8 *payload = NULL; u8 *payload = NULL;
...@@ -514,18 +514,17 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) ...@@ -514,18 +514,17 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
} }
blksz = SDIO_BLOCK_SIZE; 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 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); BT_ERR("invalid packet length: %d", buf_len);
ret = -EINVAL; ret = -EINVAL;
goto exit; goto exit;
} }
/* Allocate buffer */ /* Allocate buffer */
skb = bt_skb_alloc(buf_block_len * blksz + BTSDIO_DMA_ALIGN, skb = bt_skb_alloc(num_blocks * blksz + BTSDIO_DMA_ALIGN, GFP_ATOMIC);
GFP_ATOMIC);
if (skb == NULL) { if (skb == NULL) {
BT_ERR("No free skb"); BT_ERR("No free skb");
goto exit; goto exit;
...@@ -541,7 +540,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) ...@@ -541,7 +540,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
payload = skb->data; payload = skb->data;
ret = sdio_readsb(card->func, payload, card->ioport, ret = sdio_readsb(card->func, payload, card->ioport,
buf_block_len * blksz); num_blocks * blksz);
if (ret < 0) { if (ret < 0) {
BT_ERR("readsb failed: %d", ret); BT_ERR("readsb failed: %d", ret);
ret = -EIO; ret = -EIO;
...@@ -590,7 +589,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) ...@@ -590,7 +589,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
default: default:
BT_ERR("Unknown packet type:%d", type); BT_ERR("Unknown packet type:%d", type);
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, payload, print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, payload,
blksz * buf_block_len); blksz * num_blocks);
kfree_skb(skb); kfree_skb(skb);
skb = NULL; skb = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment