]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: core: sd: Apply BROKEN_SD_DISCARD quirk earlier
authorAvri Altman <avri.altman@sandisk.com>
Mon, 26 May 2025 11:44:45 +0000 (14:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:47 +0000 (15:57 +0200)
[ Upstream commit 009c3a4bc41e855fd76f92727f9fbae4e5917d7f ]

Move the BROKEN_SD_DISCARD quirk for certain SanDisk SD cards from the
`mmc_blk_fixups[]` to `mmc_sd_fixups[]`. This ensures the quirk is
applied earlier in the device initialization process, aligning with the
reasoning in [1]. Applying the quirk sooner prevents the kernel from
incorrectly enabling discard support on affected cards during initial
setup.

[1] https://lore.kernel.org/all/20240820230631.GA436523@sony.com

Fixes: 07d2872bf4c8 ("mmc: core: Add SD card quirk for broken discard")
Signed-off-by: Avri Altman <avri.altman@sandisk.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250526114445.675548-1-avri.altman@sandisk.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mmc/core/quirks.h

index afe8d8c5fa8a2ce1b59b16bc03ba6dfd6248b3da..2920633e2ae1e9a3beacffe4d6ffd1b2867a41c5 100644 (file)
 
 #include "card.h"
 
+static const struct mmc_fixup __maybe_unused mmc_sd_fixups[] = {
+       /*
+        * Some SD cards reports discard support while they don't
+        */
+       MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
+                 MMC_QUIRK_BROKEN_SD_DISCARD),
+
+       END_FIXUP
+};
 static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 #define INAND_CMD38_ARG_EXT_CSD  113
 #define INAND_CMD38_ARG_ERASE    0x00
@@ -112,13 +121,6 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
         */
        MMC_FIXUP("Q2J54A", CID_MANFID_MICRON, 0x014e, add_quirk_mmc,
                  MMC_QUIRK_TRIM_BROKEN),
-
-       /*
-        * Some SD cards reports discard support while they don't
-        */
-       MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
-                 MMC_QUIRK_BROKEN_SD_DISCARD),
-
        END_FIXUP
 };