* [PATCH v2] mmc: core: Normalize the error handling branch in sd_read_ext_regs()
@ 2022-11-30 13:49 Zhen Lei
2022-11-30 13:53 ` Leizhen (ThunderTown)
2022-11-30 14:43 ` Ulf Hansson
0 siblings, 2 replies; 3+ messages in thread
From: Zhen Lei @ 2022-11-30 13:49 UTC (permalink / raw)
To: Ulf Hansson, linux-mmc, linux-kernel; +Cc: Zhen Lei
1. Use pr_err() to output the error message.
2. Add the description of why success 0 is returned in case
"non-supported SD ext reg layout".
Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/mmc/core/sd.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 3662bf5320ce56d..93ee53f74427c38 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1259,7 +1259,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
*/
err = sd_read_ext_reg(card, 0, 0, 0, 512, gen_info_buf);
if (err) {
- pr_warn("%s: error %d reading general info of SD ext reg\n",
+ pr_err("%s: error %d reading general info of SD ext reg\n",
mmc_hostname(card->host), err);
goto out;
}
@@ -1273,7 +1273,12 @@ static int sd_read_ext_regs(struct mmc_card *card)
/* Number of extensions to be find. */
num_ext = gen_info_buf[4];
- /* We support revision 0, but limit it to 512 bytes for simplicity. */
+ /*
+ * We only support revision 0, and limit it to 512 bytes for simplicity.
+ * In other cases, success 0 is returned, because the card remains
+ * functional and all but the new features from the SD function
+ * extensions registers can still be used.
+ */
if (rev != 0 || len > 512) {
pr_warn("%s: non-supported SD ext reg layout\n",
mmc_hostname(card->host));
@@ -1288,7 +1293,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
for (i = 0; i < num_ext; i++) {
err = sd_parse_ext_reg(card, gen_info_buf, &next_ext_addr);
if (err) {
- pr_warn("%s: error %d parsing SD ext reg\n",
+ pr_err("%s: error %d parsing SD ext reg\n",
mmc_hostname(card->host), err);
goto out;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mmc: core: Normalize the error handling branch in sd_read_ext_regs()
2022-11-30 13:49 [PATCH v2] mmc: core: Normalize the error handling branch in sd_read_ext_regs() Zhen Lei
@ 2022-11-30 13:53 ` Leizhen (ThunderTown)
2022-11-30 14:43 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Leizhen (ThunderTown) @ 2022-11-30 13:53 UTC (permalink / raw)
To: Ulf Hansson, linux-mmc, linux-kernel
On 2022/11/30 21:49, Zhen Lei wrote:
> 1. Use pr_err() to output the error message.
> 2. Add the description of why success 0 is returned in case
> "non-supported SD ext reg layout".
>
> Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management")
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> drivers/mmc/core/sd.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
Sorry, I forgot to add the version difference description.
v1 --> v2:
Add a description instead of returning an error code.
v1:
https://lkml.org/lkml/2022/11/30/240
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 3662bf5320ce56d..93ee53f74427c38 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1259,7 +1259,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
> */
> err = sd_read_ext_reg(card, 0, 0, 0, 512, gen_info_buf);
> if (err) {
> - pr_warn("%s: error %d reading general info of SD ext reg\n",
> + pr_err("%s: error %d reading general info of SD ext reg\n",
> mmc_hostname(card->host), err);
> goto out;
> }
> @@ -1273,7 +1273,12 @@ static int sd_read_ext_regs(struct mmc_card *card)
> /* Number of extensions to be find. */
> num_ext = gen_info_buf[4];
>
> - /* We support revision 0, but limit it to 512 bytes for simplicity. */
> + /*
> + * We only support revision 0, and limit it to 512 bytes for simplicity.
> + * In other cases, success 0 is returned, because the card remains
> + * functional and all but the new features from the SD function
> + * extensions registers can still be used.
> + */
> if (rev != 0 || len > 512) {
> pr_warn("%s: non-supported SD ext reg layout\n",
> mmc_hostname(card->host));
> @@ -1288,7 +1293,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
> for (i = 0; i < num_ext; i++) {
> err = sd_parse_ext_reg(card, gen_info_buf, &next_ext_addr);
> if (err) {
> - pr_warn("%s: error %d parsing SD ext reg\n",
> + pr_err("%s: error %d parsing SD ext reg\n",
> mmc_hostname(card->host), err);
> goto out;
> }
>
--
Regards,
Zhen Lei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mmc: core: Normalize the error handling branch in sd_read_ext_regs()
2022-11-30 13:49 [PATCH v2] mmc: core: Normalize the error handling branch in sd_read_ext_regs() Zhen Lei
2022-11-30 13:53 ` Leizhen (ThunderTown)
@ 2022-11-30 14:43 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-11-30 14:43 UTC (permalink / raw)
To: Zhen Lei; +Cc: linux-mmc, linux-kernel
On Wed, 30 Nov 2022 at 14:49, Zhen Lei <thunder.leizhen@huawei.com> wrote:
>
> 1. Use pr_err() to output the error message.
> 2. Add the description of why success 0 is returned in case
> "non-supported SD ext reg layout".
>
> Fixes: c784f92769ae ("mmc: core: Read the SD function extension registers for power management")
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/core/sd.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 3662bf5320ce56d..93ee53f74427c38 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1259,7 +1259,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
> */
> err = sd_read_ext_reg(card, 0, 0, 0, 512, gen_info_buf);
> if (err) {
> - pr_warn("%s: error %d reading general info of SD ext reg\n",
> + pr_err("%s: error %d reading general info of SD ext reg\n",
> mmc_hostname(card->host), err);
> goto out;
> }
> @@ -1273,7 +1273,12 @@ static int sd_read_ext_regs(struct mmc_card *card)
> /* Number of extensions to be find. */
> num_ext = gen_info_buf[4];
>
> - /* We support revision 0, but limit it to 512 bytes for simplicity. */
> + /*
> + * We only support revision 0, and limit it to 512 bytes for simplicity.
> + * In other cases, success 0 is returned, because the card remains
> + * functional and all but the new features from the SD function
> + * extensions registers can still be used.
> + */
> if (rev != 0 || len > 512) {
> pr_warn("%s: non-supported SD ext reg layout\n",
> mmc_hostname(card->host));
> @@ -1288,7 +1293,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
> for (i = 0; i < num_ext; i++) {
> err = sd_parse_ext_reg(card, gen_info_buf, &next_ext_addr);
> if (err) {
> - pr_warn("%s: error %d parsing SD ext reg\n",
> + pr_err("%s: error %d parsing SD ext reg\n",
> mmc_hostname(card->host), err);
> goto out;
> }
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-30 14:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 13:49 [PATCH v2] mmc: core: Normalize the error handling branch in sd_read_ext_regs() Zhen Lei
2022-11-30 13:53 ` Leizhen (ThunderTown)
2022-11-30 14:43 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®