Skip to content

Commit

Permalink
mmc: core: Delete error messages for failed memory allocations
Browse files Browse the repository at this point in the history
Omit an extra message for memory allocation failures.

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@users.sourceforge.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Markus Elfring authored and Ulf Hansson committed Jun 20, 2017
1 parent 9b344ba commit e1df7ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 0 additions & 2 deletions drivers/mmc/core/mmc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
16 changes: 3 additions & 13 deletions drivers/mmc/core/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) &&
Expand Down

0 comments on commit e1df7ae

Please sign in to comment.