Skip to content

Commit 5b2e2ec

Browse files
bingzlinvjw
authored andcommitted
mwifiex: do not overwrite error code from lower layer driver
Instead of converting it to a bogus error code -1, we should return the original error code from lower layer driver. This error code will be printed so it may give user some clues on what has happened. Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 3220712 commit 5b2e2ec

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎drivers/net/wireless/mwifiex/sdio.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ mwifiex_write_data_sync(struct mwifiex_adapter *adapter,
332332
u8 *buffer, u32 pkt_len, u32 port)
333333
{
334334
struct sdio_mmc_card *card = adapter->card;
335-
int ret = -1;
335+
int ret;
336336
u8 blk_mode =
337337
(port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE;
338338
u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1;
@@ -350,8 +350,7 @@ mwifiex_write_data_sync(struct mwifiex_adapter *adapter,
350350

351351
sdio_claim_host(card->func);
352352

353-
if (!sdio_writesb(card->func, ioport, buffer, blk_cnt * blk_size))
354-
ret = 0;
353+
ret = sdio_writesb(card->func, ioport, buffer, blk_cnt * blk_size);
355354

356355
sdio_release_host(card->func);
357356

@@ -365,7 +364,7 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer,
365364
u32 len, u32 port, u8 claim)
366365
{
367366
struct sdio_mmc_card *card = adapter->card;
368-
int ret = -1;
367+
int ret;
369368
u8 blk_mode = (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE
370369
: BLOCK_MODE;
371370
u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1;
@@ -376,8 +375,7 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer,
376375
if (claim)
377376
sdio_claim_host(card->func);
378377

379-
if (!sdio_readsb(card->func, buffer, ioport, blk_cnt * blk_size))
380-
ret = 0;
378+
ret = sdio_readsb(card->func, buffer, ioport, blk_cnt * blk_size);
381379

382380
if (claim)
383381
sdio_release_host(card->func);

‎drivers/net/wireless/mwifiex/usb.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ static int mwifiex_write_data_sync(struct mwifiex_adapter *adapter, u8 *pbuf,
672672
*len, &actual_length, timeout);
673673
if (ret) {
674674
dev_err(adapter->dev, "usb_bulk_msg for tx failed: %d\n", ret);
675-
ret = -1;
675+
return ret;
676676
}
677677

678678
*len = actual_length;
@@ -691,7 +691,7 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *pbuf,
691691
*len, &actual_length, timeout);
692692
if (ret) {
693693
dev_err(adapter->dev, "usb_bulk_msg for rx failed: %d\n", ret);
694-
ret = -1;
694+
return ret;
695695
}
696696

697697
*len = actual_length;

0 commit comments

Comments
 (0)