[PATCH] staging:rts_pstor:Fix SDIO issue

wwang wei_wang at realsil.com.cn
Sun Oct 9 06:48:17 UTC 2011


Dear Carpenter:

Yes, the new code is exactly what I intended.
As to the following code, the old system responded fully wrong. It
should return STATUS_FAIL here instead.

3144 if (CHECK_PID(chip, 0x5209)) {
3145 retval = sd_change_bank_voltage(chip, SD_IO_3V3);
3146 if (retval != STATUS_SUCCESS) {
3147 TRACE_RET(chip, STATUS_FAIL);
3148 }
3149 }


Indeed, returning STATUS_FAIL directly would look like more consice and
neat. But in the following code (line 3164) it would not work because we
may need to call reset_mmc function. In order to keep the code
consistent, I introduce the "reset_pass" variable.
Another method to fix this bug is to add "retval = STATUS_FAIL" after
line 3167. But I don't think this style is clear enough, comparing with
adding a new variable.

3157 retval = reset_sd(chip);
3158 if (retval != STATUS_SUCCESS) {
3159 if (sd_check_err_code(chip, SD_NO_CARD)) {
3160 TRACE_RET(chip, STATUS_FAIL);
3161 }
3162
3163 if (CHECK_PID(chip, 0x5209)) {
3164 retval = sd_change_bank_voltage(chip, SD_IO_3V3);
3165 if (retval != STATUS_SUCCESS) {
3166 TRACE_RET(chip, STATUS_FAIL);
3167 }
3168 }
3169
3170 if (!chip->sd_io) {
3171 retval = reset_mmc(chip);
3172 if (retval == STATUS_SUCCESS)
3173 reset_pass = 1;
3174 }
3175 } else {
3176 reset_pass = 1;
3177 }


Best regards,
wwang




More information about the devel mailing list