diff mbox series

mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check

Message ID 20221119030400.1789919-1-sebastian.falbesoner@gmail.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check | expand

Commit Message

Sebastian Falbesoner Nov. 19, 2022, 3:04 a.m. UTC
With the current logic the "failed to exit halt state" error would be
shown even if any other bit than CQHCI_HALT was set in the CQHCI_CTL
register, since the right hand side is always true. Fix this by using
the correct operator (bit-wise instead of logical AND) to only check for
the halt bit flag, which was obviously intended here.

Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bough Chen Nov. 21, 2022, 2:56 a.m. UTC | #1
> -----Original Message-----
> From: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
> Sent: 2022年11月19日 11:04
> To: Adrian Hunter <adrian.hunter@intel.com>; Bough Chen
> <haibo.chen@nxp.com>; Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc@vger.kernel.org; Sebastian Falbesoner
> <sebastian.falbesoner@gmail.com>
> Subject: [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
> 
> With the current logic the "failed to exit halt state" error would be shown even
> if any other bit than CQHCI_HALT was set in the CQHCI_CTL register, since the
> right hand side is always true. Fix this by using the correct operator (bit-wise
> instead of logical AND) to only check for the halt bit flag, which was obviously
> intended here.
> 
> Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>

Thanks for the catch. Please add the fix tag in the commit log, and then I can give my ack.

Best Regards
Haibo chen
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 31ea0a2fce35..ffeb5759830f 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host
> *mmc)
>  	 * system resume back.
>  	 */
>  	cqhci_writel(cq_host, 0, CQHCI_CTL);
> -	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
> +	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
>  		dev_err(mmc_dev(host->mmc),
>  			"failed to exit halt state when enable CQE\n");
> 
> --
> 2.34.1
Adrian Hunter Nov. 21, 2022, 8:53 a.m. UTC | #2
On 19/11/22 05:04, Sebastian Falbesoner wrote:
> With the current logic the "failed to exit halt state" error would be
> shown even if any other bit than CQHCI_HALT was set in the CQHCI_CTL
> register, since the right hand side is always true. Fix this by using
> the correct operator (bit-wise instead of logical AND) to only check for
> the halt bit flag, which was obviously intended here.
> 
> Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>

Fixes: 85236d2be844 ("mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE")
Acked-by: Adrian Hunter <adrian.hunter@intel.com>


> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 31ea0a2fce35..ffeb5759830f 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host *mmc)
>  	 * system resume back.
>  	 */
>  	cqhci_writel(cq_host, 0, CQHCI_CTL);
> -	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
> +	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
>  		dev_err(mmc_dev(host->mmc),
>  			"failed to exit halt state when enable CQE\n");
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 31ea0a2fce35..ffeb5759830f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1512,7 +1512,7 @@  static void esdhc_cqe_enable(struct mmc_host *mmc)
 	 * system resume back.
 	 */
 	cqhci_writel(cq_host, 0, CQHCI_CTL);
-	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
+	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
 		dev_err(mmc_dev(host->mmc),
 			"failed to exit halt state when enable CQE\n");