UPSTREAM: mwifiex: do not overwrite error code from lower layer driver
authorBing Zhao <bzhao@marvell.com>
Mon, 28 Jan 2013 22:27:59 +0000 (14:27 -0800)
committerChromeBot <chrome-bot@google.com>
Wed, 30 Jan 2013 21:25:23 +0000 (13:25 -0800)
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>
BUG=chrome-os-partner:17015
TEST=tested with the bad unit that fails with error message
"mwifiex_sdio_card_to_host: read iomem failed: -1". Now it says
"mwifiex_sdio_card_to_host: read iomem failed: -84".

Change-Id: I18fa13eb232739a4175e6e37469f3448fb0a58eb
Reviewed-on: https://gerrit.chromium.org/gerrit/42162
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Bing Zhao <bzhao@marvell.com>
Commit-Queue: Bing Zhao <bzhao@marvell.com>

drivers/net/wireless/mwifiex/sdio.c

index 8ad602f..54c0c14 100644 (file)
@@ -335,7 +335,7 @@ mwifiex_write_data_sync(struct mwifiex_adapter *adapter,
                        u8 *buffer, u32 pkt_len, u32 port)
 {
        struct sdio_mmc_card *card = adapter->card;
-       int ret = -1;
+       int ret;
        u8 blk_mode =
                (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE;
        u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1;
@@ -353,8 +353,7 @@ mwifiex_write_data_sync(struct mwifiex_adapter *adapter,
 
        sdio_claim_host(card->func);
 
-       if (!sdio_writesb(card->func, ioport, buffer, blk_cnt * blk_size))
-               ret = 0;
+       ret = sdio_writesb(card->func, ioport, buffer, blk_cnt * blk_size);
 
        sdio_release_host(card->func);
 
@@ -368,7 +367,7 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer,
                                  u32 len, u32 port, u8 claim)
 {
        struct sdio_mmc_card *card = adapter->card;
-       int ret = -1;
+       int ret;
        u8 blk_mode = (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE
                       : BLOCK_MODE;
        u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1;
@@ -379,8 +378,7 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer,
        if (claim)
                sdio_claim_host(card->func);
 
-       if (!sdio_readsb(card->func, buffer, ioport, blk_cnt * blk_size))
-               ret = 0;
+       ret = sdio_readsb(card->func, buffer, ioport, blk_cnt * blk_size);
 
        if (claim)
                sdio_release_host(card->func);