Message ID | 1511965794-24118-6-git-send-email-jjhiblot@ti.com |
---|---|
State | Superseded |
Delegated to: | Jaehoon Chung |
Headers | show |
Series | mmc: fixes for HS200/UHS core support | expand |
On 29 November 2017 at 07:29, Jean-Jacques Hiblot <jjhiblot@ti.com> wrote: > The ext_csd is allocated only for MMC above version 4. The compare will > crash or fail for older MMCs. > > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> > --- > drivers/mmc/mmc.c | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 0ebcc45..2a58031 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1657,6 +1657,9 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc) const u8 *ext_csd = mmc->ext_csd; ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN); + if (mmc->version < MMC_VERSION_4) + return 0; + err = mmc_send_ext_csd(mmc, test_csd); if (err) return err;
The ext_csd is allocated only for MMC above version 4. The compare will crash or fail for older MMCs. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> --- drivers/mmc/mmc.c | 3 +++ 1 file changed, 3 insertions(+)