Skip to contentSkip to conversation

mmc: core: skip card initialization if power class selection fails

PATCH In review Subhash Jadavani 3 participants 4 messages Apr 12, 2012 – May 9, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mmc: core: skip card initialization if power class selection fails

With current implementation of power class selection, mmc_select_powerclass() should never fail. So treat any error returned by this function as serious enough to skip the card initialization.

---
 drivers/mmc/core/mmc.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
drivers/mmc/core/mmc.c +7 -11
index 54df5ad..bfc987f 100644
@@ -736,6 +736,10 @@ static int mmc_select_powerclass(struct mmc_card *card,
 				 card->ext_csd.generic_cmd6_time);
 	}
 
+	if (err)
+		pr_err("%s: power class selection for ext_csd_bus_width %d"
+		       " failed\n", mmc_hostname(card->host), bus_width);
+
 	return err;
 }
 
@@ -1117,9 +1121,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 				EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4;
 		err = mmc_select_powerclass(card, ext_csd_bits, ext_csd);
 		if (err)
-			pr_warning("%s: power class selection to bus width %d"
-				   " failed\n", mmc_hostname(card->host),
-				   1 << bus_width);
+			goto err;
 	}
 
 	/*
@@ -1151,10 +1153,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 			err = mmc_select_powerclass(card, ext_csd_bits[idx][0],
 						    ext_csd);
 			if (err)
-				pr_warning("%s: power class selection to "
-					   "bus width %d failed\n",
-					   mmc_hostname(card->host),
-					   1 << bus_width);
+				goto err;
 
 			err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 					 EXT_CSD_BUS_WIDTH,
@@ -1182,10 +1181,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 			err = mmc_select_powerclass(card, ext_csd_bits[idx][1],
 						    ext_csd);
 			if (err)
-				pr_warning("%s: power class selection to "
-					   "bus width %d ddr %d failed\n",
-					   mmc_hostname(card->host),
-					   1 << bus_width, ddr);
+				goto err;
 
 			err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 					 EXT_CSD_BUS_WIDTH,
Signature · 5 lines
1.7.1.1

--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw

Hi Chris,

Is this patch looks ok?

Regards,
Subhash

Quoted 22 lines

-----Original Message-----
From: [email protected] [mailto:linux-arm-msm- [email protected]] On Behalf Of Namjae Jeon
Sent: Friday, April 13, 2012 8:12 PM
To: Subhash Jadavani; Chris Ball
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v3 1/1] mmc: core: skip card initialization if power class selection fails

2012/4/12 Subhash Jadavani <[email protected]>:

Quoted 5 lines

With current implementation of power class selection, mmc_select_powerclass() should never fail. So treat any error returned by this function as serious enough to skip the card initialization.

Looks good to me.

Quoted 1 line

---

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Namjae Jeon

Hi,

Quoted 9 lines · Namjae Jeon

2012/4/12 Subhash Jadavani <[email protected]>:

Quoted 6 lines

With current implementation of power class selection, mmc_select_powerclass() should never fail. So treat any error returned by this function as serious enough to skip the card initialization.

Looks good to me.

Thanks, pushed to mmc-next for 3.5.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child