Skip to contentSkip to conversation

mmc: core: add error message when switching fails in mmc_select_hs()

PATCH RESEND In review Jungseung Lee 2 participants 3 messages Aug 23, 2016 – Aug 24, 2016 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 mmc: core: add error message when switching fails in mmc_select_hs()

The switch failure message in mmc_select_timing had been removed since that is invalid: commit 0400ed0a083a ("mmc: core: remove the invalid message in mmc_select_timing")

Now, in the case when mmc_select_hs return error in mmc_select_timing, there is nothing to print failure message.
Let's make for mmc_select_hs() print message itself in the failure case.

---
 drivers/mmc/core/mmc.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/mmc/core/mmc.c +6 -4
index f2d185c..e07fcce 100644
@@ -1018,6 +1018,7 @@ static int mmc_switch_status(struct mmc_card *card)
  */
 static int mmc_select_hs(struct mmc_card *card)
 {
+	struct mmc_host *host = card->host;
 	int err;
 
 	err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@@ -1029,6 +1030,10 @@ static int mmc_select_hs(struct mmc_card *card)
 		err = mmc_switch_status(card);
 	}
 
+	if (err)
+		pr_err("%s: switch to high-speed failed, err:%d\n",
+			mmc_hostname(host), err);
+
 	return err;
 }
 
@@ -1265,11 +1270,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
 
 	/* Switch card to HS mode */
 	err = mmc_select_hs(card);
-	if (err) {
-		pr_err("%s: switch to high-speed failed, err:%d\n",
-			mmc_hostname(host), err);
+	if (err)
 		goto out_err;
-	}
 
 	err = mmc_switch_status(card);
 	if (err)
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 18 lines · Jungseung Lee

The switch failure message in mmc_select_timing had been removed since that is invalid: commit 0400ed0a083a ("mmc: core: remove the invalid message in mmc_select_timing")

Now, in the case when mmc_select_hs return error in mmc_select_timing, there is nothing to print failure message.
Let's make for mmc_select_hs() print message itself in the failure case.

---
 drivers/mmc/core/mmc.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/mmc/core/mmc.c +0 -0
index f2d185c..e07fcce 100644

drivers/mmc/core/mmc.c static int mmc_switch_status(struct mmc_card *card) · line 1021

Quoted 4 lines
drivers/mmc/core/mmc.c +1 -0
@@ -1018,6 +1018,7 @@ static int mmc_switch_status(struct mmc_card *card)
  */
 static int mmc_select_hs(struct mmc_card *card)
 {
+       struct mmc_host *host = card->host;

No need for local variable here, just use card->host below instead.

drivers/mmc/core/mmc.c static int mmc_select_hs(struct mmc_card *card) · line 1035

Quoted 10 lines
drivers/mmc/core/mmc.c +3 -0
        int err;
 
        err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@@ -1029,6 +1030,10 @@ static int mmc_select_hs(struct mmc_card *card)
                err = mmc_switch_status(card);
        }
 
+       if (err)
+               pr_err("%s: switch to high-speed failed, err:%d\n",
+                       mmc_hostname(host), err);

I think a pr_warn() would be better as mmc_select_timing() uses the legacy speed mode when err == -EBADMSG.

Quoted 18 lines
drivers/mmc/core/mmc.c +2 -5
+
        return err;
 }
 
@@ -1265,11 +1270,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
 
        /* Switch card to HS mode */
        err = mmc_select_hs(card);
-       if (err) {
-               pr_err("%s: switch to high-speed failed, err:%d\n",
-                       mmc_hostname(host), err);
+       if (err)
                goto out_err;
-       }
 
        err = mmc_switch_status(card);
        if (err)
--
Quoted 2 lines

1.7.9.5

Kind regards
Uffe

author
#3 lore raw
In reply to a message not in the archive

Hi,

Quoted 7 lines
Quoted 5 lines

 @@ -1018,6 +1018,7 @@ static int mmc_switch_status(struct mmc_card *card) */
  static int mmc_select_hs(struct mmc_card *card)
  {
 +       struct mmc_host *host = card->host;


No need for local variable here, just use card->host below instead.

Yes, it should be.

Quoted 7 lines
Quoted 7 lines

         int err;

         err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 @@ -1029,6 +1030,10 @@ static int mmc_select_hs(struct mmc_card *card) err = mmc_switch_status(card);
         }

Quoted 6 lines
Quoted 3 lines

 +       if (err)
 +               pr_err("%s: switch to high-speed failed, err:%d\n", +                       mmc_hostname(host), err);


I think a pr_warn() would be better as mmc_select_timing() uses the legacy speed mode when err == -EBADMSG.

I agree. A modified patch will be sent right after. Thanks for your comment.

Quoted 7 lines
Quoted 4 lines

 +
         return err;
  }


Kind regards
Uffe