Commit e040b626 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman

staging: rts5208: fix style warnings in sd.c

This patch fixes the following checkpatch.pl warning in sd.c:
WARNING: else is not generally useful after a break or return

It also makes code more uniform with the new changes
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9afccdfe
...@@ -2588,16 +2588,12 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2588,16 +2588,12 @@ static int reset_sd(struct rtsx_chip *chip)
#endif #endif
retval = sd_prepare_reset(chip); retval = sd_prepare_reset(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
retval = sd_dummy_clock(chip); retval = sd_dummy_clock(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip) && try_sdio) { if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip) && try_sdio) {
int rty_cnt = 0; int rty_cnt = 0;
...@@ -2605,8 +2601,7 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2605,8 +2601,7 @@ static int reset_sd(struct rtsx_chip *chip)
for (; rty_cnt < chip->sdio_retry_cnt; rty_cnt++) { for (; rty_cnt < chip->sdio_retry_cnt; rty_cnt++) {
if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) {
sd_set_err_code(chip, SD_NO_CARD); sd_set_err_code(chip, SD_NO_CARD);
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
} }
retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0, retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0,
...@@ -2618,8 +2613,7 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2618,8 +2613,7 @@ static int reset_sd(struct rtsx_chip *chip)
dev_dbg(rtsx_dev(chip), "SD_IO card (Function number: %d)!\n", dev_dbg(rtsx_dev(chip), "SD_IO card (Function number: %d)!\n",
func_num); func_num);
chip->sd_io = 1; chip->sd_io = 1;
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
} }
break; break;
...@@ -2637,10 +2631,8 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2637,10 +2631,8 @@ static int reset_sd(struct rtsx_chip *chip)
RTY_SD_RST: RTY_SD_RST:
retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0, retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0,
NULL, 0); NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
wait_timeout(20); wait_timeout(20);
...@@ -2658,10 +2650,8 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2658,10 +2650,8 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0,
SD_RSP_TYPE_R0, NULL, 0); SD_RSP_TYPE_R0, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
wait_timeout(20); wait_timeout(20);
} }
...@@ -2672,39 +2662,32 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2672,39 +2662,32 @@ static int reset_sd(struct rtsx_chip *chip)
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) { if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) {
sd_set_err_code(chip, SD_NO_CARD); sd_set_err_code(chip, SD_NO_CARD);
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
} }
j++; j++;
if (j < 3) { if (j < 3)
goto RTY_SD_RST; goto RTY_SD_RST;
} else { else
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
} }
retval = sd_send_cmd_get_rsp(chip, SD_APP_OP_COND, voltage, retval = sd_send_cmd_get_rsp(chip, SD_APP_OP_COND, voltage,
SD_RSP_TYPE_R3, rsp, 5); SD_RSP_TYPE_R3, rsp, 5);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
k++; k++;
if (k < 3) { if (k < 3)
goto RTY_SD_RST; goto RTY_SD_RST;
} else { else
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
} }
i++; i++;
wait_timeout(20); wait_timeout(20);
} while (!(rsp[1] & 0x80) && (i < 255)); } while (!(rsp[1] & 0x80) && (i < 255));
if (i == 255) { if (i == 255)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
if (hi_cap_flow) { if (hi_cap_flow) {
if (rsp[1] & 0x40) if (rsp[1] & 0x40)
...@@ -2721,26 +2704,20 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2721,26 +2704,20 @@ static int reset_sd(struct rtsx_chip *chip)
if (support_1v8) { if (support_1v8) {
retval = sd_voltage_switch(chip); retval = sd_voltage_switch(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
} }
retval = sd_send_cmd_get_rsp(chip, ALL_SEND_CID, 0, SD_RSP_TYPE_R2, retval = sd_send_cmd_get_rsp(chip, ALL_SEND_CID, 0, SD_RSP_TYPE_R2,
NULL, 0); NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
retval = sd_send_cmd_get_rsp(chip, SEND_RELATIVE_ADDR, 0, retval = sd_send_cmd_get_rsp(chip, SEND_RELATIVE_ADDR, 0,
SD_RSP_TYPE_R6, rsp, 5); SD_RSP_TYPE_R6, rsp, 5);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
sd_card->sd_addr = (u32)rsp[1] << 24; sd_card->sd_addr = (u32)rsp[1] << 24;
sd_card->sd_addr += (u32)rsp[2] << 16; sd_card->sd_addr += (u32)rsp[2] << 16;
...@@ -2750,24 +2727,18 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2750,24 +2727,18 @@ static int reset_sd(struct rtsx_chip *chip)
} }
retval = sd_check_csd(chip, 1); retval = sd_check_csd(chip, 1);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
retval = sd_select_card(chip, 1); retval = sd_select_card(chip, 1);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
#ifdef SUPPORT_SD_LOCK #ifdef SUPPORT_SD_LOCK
SD_UNLOCK_ENTRY: SD_UNLOCK_ENTRY:
retval = sd_update_lock_status(chip); retval = sd_update_lock_status(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
if (sd_card->sd_lock_status & SD_LOCKED) { if (sd_card->sd_lock_status & SD_LOCKED) {
sd_card->sd_lock_status |= (SD_LOCK_1BIT_MODE | SD_PWD_EXIST); sd_card->sd_lock_status |= (SD_LOCK_1BIT_MODE | SD_PWD_EXIST);
...@@ -2779,32 +2750,24 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2779,32 +2750,24 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0); SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
retval = sd_send_cmd_get_rsp(chip, SET_CLR_CARD_DETECT, 0, retval = sd_send_cmd_get_rsp(chip, SET_CLR_CARD_DETECT, 0,
SD_RSP_TYPE_R1, NULL, 0); SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
if (support_1v8) { if (support_1v8) {
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0); SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2, retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2,
SD_RSP_TYPE_R1, NULL, 0); SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
switch_bus_width = SD_BUS_WIDTH_4; switch_bus_width = SD_BUS_WIDTH_4;
} else { } else {
...@@ -2813,16 +2776,12 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2813,16 +2776,12 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1, retval = sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1,
NULL, 0); NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0); retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
if (!(sd_card->raw_csd[4] & 0x40)) if (!(sd_card->raw_csd[4] & 0x40))
sd_dont_switch = true; sd_dont_switch = true;
...@@ -2861,17 +2820,13 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2861,17 +2820,13 @@ static int reset_sd(struct rtsx_chip *chip)
if (!support_1v8) { if (!support_1v8) {
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr, retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0); SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2, retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2,
SD_RSP_TYPE_R1, NULL, 0); SD_RSP_TYPE_R1, NULL, 0);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
} }
#ifdef SUPPORT_SD_LOCK #ifdef SUPPORT_SD_LOCK
...@@ -2889,10 +2844,8 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2889,10 +2844,8 @@ static int reset_sd(struct rtsx_chip *chip)
} }
retval = sd_set_init_para(chip); retval = sd_set_init_para(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
if (CHK_SD_DDR50(sd_card)) if (CHK_SD_DDR50(sd_card))
retval = sd_ddr_tuning(chip); retval = sd_ddr_tuning(chip);
...@@ -2901,14 +2854,11 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2901,14 +2854,11 @@ static int reset_sd(struct rtsx_chip *chip)
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
if (sd20_mode) { if (sd20_mode) {
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
} else { } else {
retval = sd_init_power(chip); retval = sd_init_power(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
try_sdio = false; try_sdio = false;
sd20_mode = true; sd20_mode = true;
...@@ -2929,14 +2879,11 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2929,14 +2879,11 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_read_lba0(chip); retval = sd_read_lba0(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
if (sd20_mode) { if (sd20_mode) {
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
} else { } else {
retval = sd_init_power(chip); retval = sd_init_power(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
try_sdio = false; try_sdio = false;
sd20_mode = true; sd20_mode = true;
...@@ -2947,10 +2894,8 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2947,10 +2894,8 @@ static int reset_sd(struct rtsx_chip *chip)
} }
retval = sd_check_wp_state(chip); retval = sd_check_wp_state(chip);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS)
rtsx_trace(chip); goto Status_Fail;
return STATUS_FAIL;
}
chip->card_bus_width[chip->card2lun[SD_CARD]] = 4; chip->card_bus_width[chip->card2lun[SD_CARD]] = 4;
...@@ -2972,6 +2917,10 @@ static int reset_sd(struct rtsx_chip *chip) ...@@ -2972,6 +2917,10 @@ static int reset_sd(struct rtsx_chip *chip)
#endif #endif
return STATUS_SUCCESS; return STATUS_SUCCESS;
Status_Fail:
rtsx_trace(chip);
return STATUS_FAIL;
} }
static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width) static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment