On 5 April 2012 16:48, Igor Mitsyanko <i.mitsya...@samsung.com> wrote: > @@ -416,8 +421,9 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv) > if (sd->wp_groups) > g_free(sd->wp_groups); > sd->wp_switch = bdrv ? bdrv_is_read_only(bdrv) : false; > + sd->wpgrps_size = BITS_TO_LONGS(sect); > sd->wp_groups = bitmap_new(sect);
> @@ -565,8 +605,7 @@ static void sd_lock_command(SDState *sd) > sd->card_status |= LOCK_UNLOCK_FAILED; > return; > } > - bitmap_zero(sd->wp_groups, BITS_TO_LONGS((sd->size >> (HWBLOCK_SHIFT > + > - SECTOR_SHIFT + WPGROUP_SHIFT)) + 1)); > + bitmap_zero(sd->wp_groups, sd->wpgrps_size); > sd->csd[14] &= ~0x10; > sd->card_status &= ~CARD_IS_LOCKED; > sd->pwd_len = 0; These two hunks together are still passing a count of longs rather than a count of bits to bitmap_zero(). If you fix this in the earlier patch then I think you should be able to avoid having to change the same bit of code in sd_lock_command() again in this patch. Otherwise OK. -- PMM