[PATCH v5 4/4] mmc: mtk-sd: Protect crypto capability with crypto config

From: Neeraj Soni

Date: Thu Jul 30 2026 - 10:26:23 EST


Host crypto capability can not be used if CONFIG_MMC_CRYPTO=n.
So set MMC_CAP2_CRYPTO in mmc->caps2 only if CONFIG_MMC_CRYPTO=y.

Signed-off-by: Neeraj Soni <neeraj.soni@xxxxxxxxxxxxxxxx>
---
drivers/mmc/host/mtk-sd.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 01ea3adbdf3b..c415ed97e3c2 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -3031,7 +3031,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
if (IS_ERR(host->crypto_clk))
return PTR_ERR(host->crypto_clk);
else if (host->crypto_clk)
+#ifdef CONFIG_MMC_CRYPTO
mmc->caps2 |= MMC_CAP2_CRYPTO;
+#else
+ dev_dbg(host->dev, "Enable necessary crypto config\n");
+#endif
}

host->irq = platform_get_irq(pdev, 0);
--
2.34.1