[PATCH] mci: Do not access ext_csd on SD cards
Sascha Hauer
s.hauer at pengutronix.de
Mon Mar 24 01:19:39 PDT 2025
On Mon, Mar 24, 2025 at 09:14:15AM +0100, Sascha Hauer wrote:
> SD cards do not have a ext_csd so accessing it on an SD card results in
> a NULL pointer derefence. Move the production year check to
> mci_mmc_decode_cid() which is executed for MMC devices only. While at
> it do not access ext_csd directly. We have already populated
> mci->version, so use this to check for the MMC versions which need the
> production year adjustment.
>
> Fixes: a4a78c4f32 ("mci: use struct cid")
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
> drivers/mci/mci-core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index c89322f61e..1e49969017 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -2377,6 +2377,12 @@ static int mci_mmc_decode_cid(struct mci *card)
> return -EINVAL;
> }
>
> + if (mci->version >= MMC_VERSION_4_41) {
> + /* Adjust production date as per JEDEC JESD84-B451 */
> + if (mci->cid.year < 2010)
> + mci->cid.year += 16;
> + }
The variable is named "card" in this function, not "mci". Will fix while
applying.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list