Skip to content

Commit

Permalink
Staging: rts_pstor: s/rtsx_free_dma_buf/kfree/
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alexander Beregalov authored and Greg Kroah-Hartman committed Apr 20, 2011
1 parent 24c92ea commit f7468e2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
38 changes: 19 additions & 19 deletions drivers/staging/rts_pstor/ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,11 +875,11 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}
retval = rtsx_read_register(chip, MS_TRANS_CFG, &val);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if (!(val & MS_INT_BREQ)) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA,
Expand All @@ -891,15 +891,15 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}
}
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

i = 0;
do {
retval = rtsx_read_register(chip, MS_TRANS_CFG, &val);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand All @@ -908,26 +908,26 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)

retval = ms_transfer_tpc(chip, MS_TM_NORMAL_READ, PRO_READ_LONG_DATA, 0, WAIT_INT);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

i++;
} while (i < 1024);

if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

if ((buf[0] != 0xa5) && (buf[1] != 0xc3)) {
/* Signature code is wrong */
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

if ((buf[4] < 1) || (buf[4] > 12)) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand All @@ -949,15 +949,15 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
RTSX_DEBUGP("sys_info_addr = 0x%x, sys_info_size = 0x%x\n",
sys_info_addr, sys_info_size);
if (sys_info_size != 96) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if (sys_info_addr < 0x1A0) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if ((sys_info_size + sys_info_addr) > 0x8000) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand All @@ -983,15 +983,15 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
RTSX_DEBUGP("model_name_addr = 0x%x, model_name_size = 0x%x\n",
model_name_addr, model_name_size);
if (model_name_size != 48) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if (model_name_addr < 0x1A0) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if ((model_name_size + model_name_addr) > 0x8000) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand All @@ -1004,7 +1004,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}

if (i == buf[4]) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand Down Expand Up @@ -1041,7 +1041,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
memcpy(ms_card->raw_model_name, buf + model_name_addr, 48);
#endif

rtsx_free_dma_buf(chip, buf);
kfree(buf);

#ifdef SUPPORT_MSXC
if (CHK_MSXC(ms_card)) {
Expand Down Expand Up @@ -3817,7 +3817,7 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip)

GetEKBFinish:
if (buf) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
}
return retval;
}
Expand Down Expand Up @@ -4055,7 +4055,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)

GetICVFinish:
if (buf) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
}
return retval;
}
Expand Down Expand Up @@ -4156,7 +4156,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)

SetICVFinish:
if (buf) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
}
return retval;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/rts_pstor/rtsx.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ do { \
#define SCSI_LUN(srb) ((srb)->device->lun)

#define rtsx_alloc_dma_buf(chip, size, flag) kmalloc((size), (flag))
#define rtsx_free_dma_buf(chip, ptr) kfree((ptr))

typedef unsigned long DELAY_PARA_T;

Expand Down
26 changes: 13 additions & 13 deletions drivers/staging/rts_pstor/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)

retval = rtsx_transfer_data(chip, 0, buf, pagelen, 0, DMA_FROM_DEVICE, 10000);
if (retval < 0) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
Expand All @@ -556,7 +556,7 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}

scsi_set_resid(srb, 0);
rtsx_free_dma_buf(chip, buf);
kfree(buf);

return STATUS_SUCCESS;
}
Expand Down Expand Up @@ -591,7 +591,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
while (len) {
retval = sf_enable_write(chip, SPI_WREN);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand All @@ -605,23 +605,23 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)

retval = rtsx_send_cmd(chip, 0, 100);
if (retval < 0) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
}

retval = sf_polling_status(chip, 100);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

addr++;
len--;
}

rtsx_free_dma_buf(chip, buf);
kfree(buf);

} else if (program_mode == AAI_PROGRAM) {
int first_byte = 1;
Expand Down Expand Up @@ -650,22 +650,22 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)

retval = rtsx_send_cmd(chip, 0, 100);
if (retval < 0) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
}

retval = sf_polling_status(chip, 100);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

len--;
}

rtsx_free_dma_buf(chip, buf);
kfree(buf);

retval = sf_disable_write(chip, SPI_WRDI);
if (retval != STATUS_SUCCESS)
Expand All @@ -687,7 +687,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)

retval = sf_enable_write(chip, SPI_WREN);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

Expand All @@ -702,23 +702,23 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)

retval = rtsx_transfer_data(chip, 0, buf, pagelen, 0, DMA_TO_DEVICE, 100);
if (retval < 0) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
}

retval = sf_polling_status(chip, 100);
if (retval != STATUS_SUCCESS) {
rtsx_free_dma_buf(chip, buf);
kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}

addr += pagelen;
len -= pagelen;
}

rtsx_free_dma_buf(chip, buf);
kfree(buf);
} else {
spi_set_err_code(chip, SPI_INVALID_COMMAND);
TRACE_RET(chip, STATUS_FAIL);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rts_pstor/xd.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static void xd_clear_dma_buffer(struct rtsx_chip *chip)
rtsx_write_register(chip, CARD_STOP, SD_STOP | SD_CLR_ERR, SD_STOP | SD_CLR_ERR);
}

rtsx_free_dma_buf(chip, buf);
kfree(buf);

if (chip->asic_code) {
rtsx_write_register(chip, CARD_PULL_CTL2, 0xFF, 0x55);
Expand Down

0 comments on commit f7468e2

Please sign in to comment.