Re: [PATCH] staging:rts_pstor:Fix SDIO issue
From: wwang
Date: Sun Oct 09 2011 - 02:48:51 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/