diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c index 348231418565..d40744bbafa9 100644 --- a/drivers/mmc/core/sdio_io.c +++ b/drivers/mmc/core/sdio_io.c @@ -378,15 +378,11 @@ u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret) return 0xFF; } - if (err_ret) - *err_ret = 0; - ret = mmc_io_rw_direct(func->card, 0, func->num, addr, 0, &val); - if (ret) { - if (err_ret) - *err_ret = ret; + if (err_ret) + *err_ret = ret; + if (ret) return 0xFF; - } return val; } @@ -443,7 +439,7 @@ u8 sdio_writeb_readb(struct sdio_func *func, u8 write_byte, if (err_ret) *err_ret = ret; if (ret) - val = 0xff; + return 0xff; return val; } @@ -531,15 +527,11 @@ u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret) { int ret; - if (err_ret) - *err_ret = 0; - ret = sdio_memcpy_fromio(func, func->tmpbuf, addr, 2); - if (ret) { - if (err_ret) - *err_ret = ret; + if (err_ret) + *err_ret = ret; + if (ret) return 0xFFFF; - } return le16_to_cpup((__le16 *)func->tmpbuf); } @@ -583,15 +575,11 @@ u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret) { int ret; - if (err_ret) - *err_ret = 0; - ret = sdio_memcpy_fromio(func, func->tmpbuf, addr, 4); - if (ret) { - if (err_ret) - *err_ret = ret; + if (err_ret) + *err_ret = ret; + if (ret) return 0xFFFFFFFF; - } return le32_to_cpup((__le32 *)func->tmpbuf); } @@ -642,15 +630,11 @@ unsigned char sdio_f0_readb(struct sdio_func *func, unsigned int addr, return 0xFF; } - if (err_ret) - *err_ret = 0; - ret = mmc_io_rw_direct(func->card, 0, 0, addr, 0, &val); - if (ret) { - if (err_ret) - *err_ret = ret; + if (err_ret) + *err_ret = ret; + if (ret) return 0xFF; - } return val; }