
Hi Wolfgang,
On Mon, Feb 18, 2013 at 4:15 AM, Wolfgang Denk wd@denx.de wrote:
Dear Sonic Zhang,
In message CAJxxZ0OTwow6X2KX8yAujtrxc6qicVPMO2rP4MHwJQVQUbhecw@mail.gmail.com you wrote:
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)
...
int ret = 0;
...
return ret;
return 0;
If this function can always only return 0, then please make it void.
Please fix globally.
I am sorry, this function can't be changed to void, because it may return error. See bellow code.
You are contradicting yourself. You _always_ return a 0 here. Your code CANNOT return an error code.
Maybe I didn't describe it clearly. Yes, I return 0 at the end of this function. But, the same function may return UNUSABLE_ERR(-17) at the beginning if the data flags match MMC_DATA_WRITE. That's why the function can't return void. Is anything contradicting in my explanation?
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) { u16 data_ctl = 0; u16 dma_cfg = 0; - int ret = 0; unsigned long data_size = data->blocksize * data->blocks;
/* Don't support write yet. */ if (data->flags & MMC_DATA_WRITE) return UNUSABLE_ERR;
@@ -137,7 +158,7 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) /* kick off transfer */ bfin_write_SDH_DATA_CTL(bfin_read_SDH_DATA_CTL() | DTX_DMA_E | DTX_E);
- return ret; + return 0; }
Regards,
Sonic Zhang