From 100654b51b55d99892525a98733dc464087abb77 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Mon, 8 Feb 2010 16:56:04 -0500 Subject: [PATCH] Fix all fo the bugs I introduced "improving" the code of others. mmc_ll_cmds.c: mmc_mode_select and mmc_get_configuration now work. mmc_hl_cmds.c: bug introduced by turning a var into a pointer to that variable. --- lib/driver/mmc/mmc_cmd_helper.h | 1 - lib/driver/mmc/mmc_hl_cmds.c | 2 +- lib/driver/mmc/mmc_ll_cmds.c | 3 +-- test/driver/mmc.c | 11 ----------- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/driver/mmc/mmc_cmd_helper.h b/lib/driver/mmc/mmc_cmd_helper.h index b8eb5ae2..56a3f143 100644 --- a/lib/driver/mmc/mmc_cmd_helper.h +++ b/lib/driver/mmc/mmc_cmd_helper.h @@ -33,7 +33,6 @@ if ( ! p_cdio ) return DRIVER_OP_UNINIT; \ if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED; \ \ - memset (p_buf, 0, i_size); \ CDIO_MMC_SET_COMMAND(cdb.field, mmc_cmd) /* Boilerplate initialization code to setup running MMC read command diff --git a/lib/driver/mmc/mmc_hl_cmds.c b/lib/driver/mmc/mmc_hl_cmds.c index 71ac27f9..d6c6e6a2 100644 --- a/lib/driver/mmc/mmc_hl_cmds.c +++ b/lib/driver/mmc/mmc_hl_cmds.c @@ -83,7 +83,7 @@ mmc_get_disctype( const CdIo_t *p_cdio, unsigned int i_timeout_ms, q = p+4; *p_disctype = CDIO_MMC_DISCTYPE_NO_DISC; - while ((p_disctype == CDIO_MMC_DISCTYPE_NO_DISC) && + while ((CDIO_MMC_DISCTYPE_NO_DISC == *p_disctype) && (q < p + profiles_list_length)) { profile_number = CDIO_MMC_GET_LEN16(q); profile_active = q[2] & 0x01; diff --git a/lib/driver/mmc/mmc_ll_cmds.c b/lib/driver/mmc/mmc_ll_cmds.c index 0b58b791..de6fd6c6 100644 --- a/lib/driver/mmc/mmc_ll_cmds.c +++ b/lib/driver/mmc/mmc_ll_cmds.c @@ -74,9 +74,9 @@ mmc_get_configuration(const CdIo_t *p_cdio, void *p_buf, { MMC_CMD_SETUP(CDIO_MMC_GPCMD_GET_CONFIGURATION); + CDIO_MMC_SET_READ_LENGTH8(cdb.field, i_size); if (0 == i_timeout_ms) i_timeout_ms = mmc_timeout_ms; cdb.field[1] = return_type & 0x3; - CDIO_MMC_SET_LEN16(cdb.field, 2, i_starting_feature_number); return MMC_RUN_CMD(SCSI_MMC_DATA_READ, i_timeout_ms); } @@ -289,7 +289,6 @@ mmc_read_cd(const CdIo_t *p_cdio, void *p_buf1, lsn_t i_lsn, { void *p_buf = p_buf1; uint8_t cdb9 = 0; - const unsigned int i_size = i_blocksize * i_blocks; const unsigned int i_timeout = mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2); MMC_CMD_SETUP(CDIO_MMC_GPCMD_READ_CD); diff --git a/test/driver/mmc.c b/test/driver/mmc.c index 3a276a28..6bb62cba 100644 --- a/test/driver/mmc.c +++ b/test/driver/mmc.c @@ -272,9 +272,6 @@ test_mode_select(CdIo_t *p_cdio, unsigned char *p_buf, unsigned int i_size, unsigned int i_flag) { int i_status, i; -#ifndef MODE_SELECT_FIXED - mmc_cdb_t cdb = {{0, }}; -#endif if (i_size < 10) return DRIVER_OP_BAD_PARAMETER; @@ -293,15 +290,7 @@ test_mode_select(CdIo_t *p_cdio, if (i_flag & 1) fprintf(stderr, "test_mode_select(0x%X, %d, %d) ... ", (unsigned int) p_buf[8], (unsigned int) p_buf[9], i_size); -#ifdef MODE_SELECT_FIXED i_status = mmc_mode_select_10(p_cdio, p_buf, i_size, 0x10, 10000); -#else - CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_MODE_SELECT_10); /* SPC-3 6.8 */ - cdb.field[1] = 0x10; /* PF = 1 : official SCSI mode page */ - CDIO_MMC_SET_READ_LENGTH16(cdb.field, i_size); - i_status = mmc_run_cmd(p_cdio, 10000, &cdb, SCSI_MMC_DATA_WRITE, - i_size, p_buf); -#endif return test_handle_outcome(p_cdio, i_status, sense_avail, sense_reply, i_flag & 1); }