[PATCH v2 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation

ziniu.wang_1@nxp.com posted 4 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v2 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
Posted by ziniu.wang_1@nxp.com 1 month, 1 week ago
From: Luke Wang <ziniu.wang_1@nxp.com>

mmc_validate_host_caps() already validates that HS400/HS400ES requires
8-bit bus width. Remove the duplicate validation.

Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index b607d4ffc562..d49069986efc 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1833,10 +1833,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
 
 	sdhci_get_property(pdev);
 
-	/* HS400/HS400ES require 8 bit bus */
-	if (!(host->mmc->caps & MMC_CAP_8_BIT_DATA))
-		host->mmc->caps2 &= ~(MMC_CAP2_HS400 | MMC_CAP2_HS400_ES);
-
 	if (mmc_gpio_get_cd(host->mmc) >= 0)
 		host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
-- 
2.34.1
Re: [PATCH v2 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
Posted by Adrian Hunter 4 weeks, 1 day ago
On 03/03/2026 12:50, ziniu.wang_1@nxp.com wrote:
> From: Luke Wang <ziniu.wang_1@nxp.com>
> 
> mmc_validate_host_caps() already validates that HS400/HS400ES requires
> 8-bit bus width. Remove the duplicate validation.
> 
> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index b607d4ffc562..d49069986efc 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1833,10 +1833,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
>  
>  	sdhci_get_property(pdev);
>  
> -	/* HS400/HS400ES require 8 bit bus */
> -	if (!(host->mmc->caps & MMC_CAP_8_BIT_DATA))
> -		host->mmc->caps2 &= ~(MMC_CAP2_HS400 | MMC_CAP2_HS400_ES);
> -
>  	if (mmc_gpio_get_cd(host->mmc) >= 0)
>  		host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
>
Re: [PATCH v2 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
Posted by Frank Li 1 month ago
From: Frank Li (AI-BOT) <frank.li@nxp.com>

AI bot review and may be useless.

The patch looks correct. The removal of duplicate validation is justified by
the commit message stating that mmc_validate_host_caps() already performs
this check.

A few observations:

> -	/* HS400/HS400ES require 8 bit bus */
> -	if (!(host->mmc->caps & MMC_CAP_8_BIT_DATA))
> -		host->mmc->caps2 &= ~(MMC_CAP2_HS400 | MMC_CAP2_HS400_ES);
> -

Consider verifying in a follow-up that mmc_validate_host_caps() is indeed
called after sdhci_get_property() in the probe flow, to ensure no window
exists where invalid caps could be exposed to userspace or other subsystems.

The code removal itself is clean with no resource leaks or locking issues in
the deleted section.