Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1642470
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_voltage_probe() |
| Date | 2017-05-16 14:10 +0200 |
| Message-ID | <tHJsC-5rS-17@gated-at.bofh.it> (permalink) |
| References | <tHJsB-5rS-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_voltage_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-16 14:10 +0200
csiph-web