[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ce8f8ac-d340-3f15-a698-ddfa449508e1@users.sourceforge.net>
Date: Fri, 19 May 2017 13:34:44 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
Bojan Prtvar <prtvar.b@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
Paul Burton <paul.burton@...tec.com>,
Shawn Lin <shawn.lin@...k-chips.com>,
Tomas Winkler <tomas.winkler@...el.com>,
Uri Yanai <uri.yanai@...disk.com>,
Wolfram Sang <wsa@...-dreams.de>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH v2] mmc: core: Delete an error message for a failed memory
allocation in four functions
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 19 May 2017 13:15:27 +0200
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
v2:
This refactoring superseded the update suggestion "mmc: core: Delete
an error message for a failed memory allocation in three functions"
from 2017-05-13 because another adjustment was requested by Ulf Hansson.
https://patchwork.kernel.org/patch/9725233/
https://lkml.org/lkml/2017/5/19/308
drivers/mmc/core/mmc_test.c | 2 --
drivers/mmc/core/sd.c | 16 +++-------------
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index fd1b4b8510b9..7a304a6e5bf1 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -3220,8 +3220,6 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
df = kmalloc(sizeof(*df), GFP_KERNEL);
if (!df) {
debugfs_remove(file);
- dev_err(&card->dev,
- "Can't allocate memory for internal usage.\n");
return -ENOMEM;
}
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index d109634fbfce..1d7542daecbe 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -294,12 +294,8 @@ static int mmc_read_switch(struct mmc_card *card)
err = -EIO;
status = kmalloc(64, GFP_KERNEL);
- if (!status) {
- pr_err("%s: could not allocate a buffer for "
- "switch capabilities.\n",
- mmc_hostname(card->host));
+ if (!status)
return -ENOMEM;
- }
/*
* Find out the card's support bits with a mode 0 operation.
@@ -359,11 +355,8 @@ int mmc_sd_switch_hs(struct mmc_card *card)
return 0;
status = kmalloc(64, GFP_KERNEL);
- if (!status) {
- pr_err("%s: could not allocate a buffer for "
- "switch capabilities.\n", mmc_hostname(card->host));
+ if (!status)
return -ENOMEM;
- }
err = mmc_sd_switch(card, 1, 0, 1, status);
if (err)
@@ -596,11 +589,8 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
return 0;
status = kmalloc(64, GFP_KERNEL);
- if (!status) {
- pr_err("%s: could not allocate a buffer for "
- "switch capabilities.\n", mmc_hostname(card->host));
+ if (!status)
return -ENOMEM;
- }
/* Set 4-bit bus width */
if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
--
2.13.0
Powered by blists - more mailing lists