Skip to contentSkip to conversation

mmc:core: Fix comparison issue in mmc_compare_ext_csds

PATCH In review Jurgen Heeks 3 participants 3 messages Feb 1, 2012 – Feb 5, 2012 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 mmc:core: Fix comparison issue in mmc_compare_ext_csds

Found this issue during code review. Actually, there are two issues which both compensate together in lucky case.
In unlucky case the bus width probing might not work as expected.

---
 drivers/mmc/core/mmc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/mmc.c +2 -2
index f6ac0a4..4f06c43 100644
@@ -353,7 +353,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 	}
 
 	card->ext_csd.raw_hc_erase_gap_size =
-		ext_csd[EXT_CSD_PARTITION_ATTRIBUTE];
+		ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
 	card->ext_csd.raw_sec_trim_mult =
 		ext_csd[EXT_CSD_SEC_TRIM_MULT];
 	card->ext_csd.raw_sec_erase_mult =
@@ -451,7 +451,7 @@ static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width)
 		goto out;
 
 	/* only compare read only fields */
-	err = (!(card->ext_csd.raw_partition_support ==
+	err = !((card->ext_csd.raw_partition_support ==
 			bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) &&
 		(card->ext_csd.raw_erased_mem_count ==
 			bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) &&
Signature · 1 line
1.7.1
#3 lore raw
In reply to Jurgen Heeks

Hi,

Quoted 23 lines · Jurgen Heeks

Found this issue during code review. Actually, there are two issues which both compensate together in lucky case.
In unlucky case the bus width probing might not work as expected.

---
 drivers/mmc/core/mmc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/mmc.c +1 -1
index f6ac0a4..4f06c43 100644
@@ -353,7 +353,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 	}
 
 	card->ext_csd.raw_hc_erase_gap_size =
-		ext_csd[EXT_CSD_PARTITION_ATTRIBUTE];
+		ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
 	card->ext_csd.raw_sec_trim_mult =
 		ext_csd[EXT_CSD_SEC_TRIM_MULT];
 	card->ext_csd.raw_sec_erase_mult =

drivers/mmc/core/mmc.c static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width) · line 457

Quoted 8 lines
drivers/mmc/core/mmc.c +1 -1
@@ -451,7 +451,7 @@ static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width)
 		goto out;
 
 	/* only compare read only fields */
-	err = (!(card->ext_csd.raw_partition_support ==
+	err = !((card->ext_csd.raw_partition_support ==
 			bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) &&
 		(card->ext_csd.raw_erased_mem_count ==
 			bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) &&

Thanks very much, Jurgen! Pushed to mmc-next for 3.3 with Namjae's Reviewed-by.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child