From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>, Wolfram Sang <wsa@the-dreams.de>
Subject: [PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_volta
Date: Tue, 16 May 2017 12:07:24 +0000 [thread overview]
Message-ID: <b195b319-5bc3-15d1-96e7-c19ab45e1f84@users.sourceforge.net> (raw)
In-Reply-To: <83b84f24-503b-4b45-3e4d-9c88c6b0252b@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 13:31:20 +0200
Omit two extra messages for memory allocation failures in this function.
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>
---
drivers/regulator/fixed.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 988a7472c2ab..a947f357d0f8 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -124,10 +124,9 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->desc.name = devm_kstrdup(&pdev->dev,
config->supply_name,
GFP_KERNEL);
- if (drvdata->desc.name = NULL) {
- dev_err(&pdev->dev, "Failed to allocate supply name\n");
+ if (!drvdata->desc.name)
return -ENOMEM;
- }
+
drvdata->desc.type = REGULATOR_VOLTAGE;
drvdata->desc.owner = THIS_MODULE;
drvdata->desc.ops = &fixed_voltage_ops;
@@ -138,11 +137,8 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
config->input_supply,
GFP_KERNEL);
- if (!drvdata->desc.supply_name) {
- dev_err(&pdev->dev,
- "Failed to allocate input supply\n");
+ if (!drvdata->desc.supply_name)
return -ENOMEM;
- }
}
if (config->microvolts)
--
2.13.0
next prev parent reply other threads:[~2017-05-16 12:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 12:06 [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2017-05-16 12:07 ` SF Markus Elfring [this message]
2017-05-16 12:08 ` [PATCH 2/2] regulator: fixed: Improve a size determination in two functions SF Markus Elfring
2017-12-14 13:21 ` [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2017-12-14 15:09 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b195b319-5bc3-15d1-96e7-c19ab45e1f84@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox