Possible bug in sdhci.c
In sdhci_init() a writel() is used on a byte-sized register, which would clobber the adjacent registers. Below is my suggested fix. If it looks correct, I can submit a proper patch.
Matt
drivers/mmc/sdhci.c +1 -1
@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)if (host->quirks &SDHCI_QUIRK_NO_CD ) {unsigned int status; -sdhci_writel (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST , +sdhci_writeb (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST ,SDHCI_HOST_CONTROL ); status =sdhci_readl (host,SDHCI_PRESENT_STATE );
Hi Matt,
Quoted 13 lines · Matt Reimer
In
sdhci_init()awritel()is used on a byte-sized register, which would clobber the adjacent registers. Below is my suggested fix. If it looks correct, I can submit a proper patch.Matt
drivers/mmc/sdhci.c +0
-0
drivers/mmc/sdhci.c static int sdhci_init(struct mmc *mmc) · line 418
Quoted 8 lines
drivers/mmc/sdhci.c +1
-1@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)if (host->quirks &SDHCI_QUIRK_NO_CD ) {unsigned int status; -sdhci_writel (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST , +sdhci_writeb (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST ,SDHCI_HOST_CONTROL ); status =sdhci_readl (host,SDHCI_PRESENT_STATE );
Correct again. Please send a proper patch.
Regards
? Pantelis
PATCH 1/1 mmc: sdhci: don't clobber adjacent registers
SDHCI_HOST_CONTROL is a byte-sized register, so don't write to it as if it were a long, as that would result in clobbering the three registers following.
--- drivers/mmc/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/sdhci.c +1 -1
@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)if (host->quirks &SDHCI_QUIRK_NO_CD ) {unsigned int status; -sdhci_writel (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST , +sdhci_writeb (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST ,SDHCI_HOST_CONTROL ); status =sdhci_readl (host,SDHCI_PRESENT_STATE );
Signature · 1 line
1.7.9.5
PATCH 1/1 mmc: sdhci: don't clobber adjacent registers
Quoted 23 lines · Matt Reimer
SDHCI_HOST_CONTROLis a byte-sized register, so don't write to it as if it were a long, as that would result in clobbering the three registers following.Signed-off-by Matt Reimer <[email protected]>--- drivers/mmc/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/sdhci.c +1
-1@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)if (host->quirks &SDHCI_QUIRK_NO_CD ) {unsigned int status; -sdhci_writel (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST , +sdhci_writeb (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST ,SDHCI_HOST_CONTROL );
Quoted 5 lines
status = sdhci_readl(host, SDHCI_PRESENT_STATE);--
1.7.9.5
ping
PATCH 1/1 mmc: sdhci: don't clobber adjacent registers
In reply to Matt ReimerHi Matt,
Quoted 27 lines · Matt Reimer
SDHCI_HOST_CONTROLis a byte-sized register, so don't write to it as if it were a long, as that would result in clobbering the three registers following.Signed-off-by Matt Reimer <[email protected]>---
drivers/mmc/sdhci.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/sdhci.c +1
-1@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)if (host->quirks &SDHCI_QUIRK_NO_CD ) {unsigned int status; -sdhci_writel (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST , +sdhci_writeb (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST ,SDHCI_HOST_CONTROL ); status =sdhci_readl (host,SDHCI_PRESENT_STATE );Signature · 1 line
1.7.9.5
The patch is obviously correct and I?ll pick it up for my next pull-req.
Relax :)
Regards
? Pantelis
Pantelis Antoniou
AppliedPATCH 1/1 mmc: sdhci: don't clobber adjacent registers
In reply to Matt ReimerHi Matt,
Quoted 27 lines · Matt Reimer
SDHCI_HOST_CONTROLis a byte-sized register, so don't write to it as if it were a long, as that would result in clobbering the three registers following.Signed-off-by Matt Reimer <[email protected]>---
drivers/mmc/sdhci.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/sdhci.c +1
-1@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)if (host->quirks &SDHCI_QUIRK_NO_CD ) {unsigned int status; -sdhci_writel (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST , +sdhci_writeb (host,SDHCI_CTRL_CD_TEST_INS |SDHCI_CTRL_CD_TEST ,SDHCI_HOST_CONTROL ); status =sdhci_readl (host,SDHCI_PRESENT_STATE );Signature · 1 line
1.7.9.5
Thanks, applied.
? Pantelis