Signed-off-by: Alexander Beregalov <a.beregalov@xxxxxxxxx> --- drivers/staging/rts_pstor/ms.c | 38 +++++++++++++++++++------------------- drivers/staging/rts_pstor/rtsx.h | 1 - drivers/staging/rts_pstor/spi.c | 26 +++++++++++++------------- drivers/staging/rts_pstor/xd.c | 2 +- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c index 810e170..58fc7e0 100644 --- a/drivers/staging/rts_pstor/ms.c +++ b/drivers/staging/rts_pstor/ms.c @@ -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, @@ -891,7 +891,7 @@ 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); } @@ -899,7 +899,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) 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); } @@ -908,7 +908,7 @@ 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); } @@ -916,18 +916,18 @@ static int ms_read_attribute_info(struct rtsx_chip *chip) } 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); } @@ -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); } @@ -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); } @@ -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); } @@ -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)) { @@ -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; } @@ -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; } @@ -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; } diff --git a/drivers/staging/rts_pstor/rtsx.h b/drivers/staging/rts_pstor/rtsx.h index 4d5ddf6..263524c 100644 --- a/drivers/staging/rts_pstor/rtsx.h +++ b/drivers/staging/rts_pstor/rtsx.h @@ -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; diff --git a/drivers/staging/rts_pstor/spi.c b/drivers/staging/rts_pstor/spi.c index 8a8689b..3daab9a 100644 --- a/drivers/staging/rts_pstor/spi.c +++ b/drivers/staging/rts_pstor/spi.c @@ -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); @@ -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; } @@ -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); } @@ -605,7 +605,7 @@ 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); @@ -613,7 +613,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = sf_polling_status(chip, 100); if (retval != STATUS_SUCCESS) { - rtsx_free_dma_buf(chip, buf); + kfree(buf); TRACE_RET(chip, STATUS_FAIL); } @@ -621,7 +621,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) len--; } - rtsx_free_dma_buf(chip, buf); + kfree(buf); } else if (program_mode == AAI_PROGRAM) { int first_byte = 1; @@ -650,7 +650,7 @@ 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); @@ -658,14 +658,14 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) 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) @@ -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); } @@ -702,7 +702,7 @@ 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); @@ -710,7 +710,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) retval = sf_polling_status(chip, 100); if (retval != STATUS_SUCCESS) { - rtsx_free_dma_buf(chip, buf); + kfree(buf); TRACE_RET(chip, STATUS_FAIL); } @@ -718,7 +718,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip) len -= pagelen; } - rtsx_free_dma_buf(chip, buf); + kfree(buf); } else { spi_set_err_code(chip, SPI_INVALID_COMMAND); TRACE_RET(chip, STATUS_FAIL); diff --git a/drivers/staging/rts_pstor/xd.c b/drivers/staging/rts_pstor/xd.c index 7bcd468..b9eb072 100644 --- a/drivers/staging/rts_pstor/xd.c +++ b/drivers/staging/rts_pstor/xd.c @@ -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); -- 1.7.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel