* [PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_volta
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
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
2 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-16 12:07 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, kernel-janitors; +Cc: LKML, Wolfram Sang
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] regulator: fixed: Improve a size determination in two functions
2017-05-16 12:06 [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2017-05-16 12:07 ` [PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_volta SF Markus Elfring
@ 2017-05-16 12:08 ` SF Markus Elfring
2017-12-14 13:21 ` [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-16 12:08 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, kernel-janitors; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 13:43:11 +0200
Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/regulator/fixed.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index a947f357d0f8..c33e930c9587 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -54,8 +54,7 @@ of_get_fixed_voltage_config(struct device *dev,
struct device_node *np = dev->of_node;
struct regulator_init_data *init_data;
- config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config),
- GFP_KERNEL);
+ config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL);
if (!config)
return ERR_PTR(-ENOMEM);
@@ -104,8 +103,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
struct regulator_config cfg = { };
int ret;
- drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data),
- GFP_KERNEL);
+ drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
--
2.13.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations
2017-05-16 12:06 [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2017-05-16 12:07 ` [PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_volta SF Markus Elfring
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 ` SF Markus Elfring
2017-12-14 15:09 ` Mark Brown
2 siblings, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2017-12-14 13:21 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, kernel-janitors; +Cc: LKML
> Date: Tue, 16 May 2017 13:55:44 +0200
>
> Two update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (2):
> Delete error messages for failed memory allocations in reg_fixed_voltage_probe()
> Improve a size determination in two functions
>
> drivers/regulator/fixed.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
How are the chances that such change possibilities will be integrated
in this software module?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations
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
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2017-12-14 15:09 UTC (permalink / raw)
To: SF Markus Elfring; +Cc: Liam Girdwood, kernel-janitors, LKML
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]
On Thu, Dec 14, 2017 at 02:21:55PM +0100, SF Markus Elfring wrote:
> How are the chances that such change possibilities will be integrated
> in this software module?
Please don't send content free pings and please allow a reasonable time
for review. People get busy, go on holiday, attend conferences and so
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review. If there have been
review comments then people may be waiting for those to be addressed.
Sending content free pings adds to the mail volume (if they are seen at
all) which is often the problem and since they can't be reviewed
directly if something has gone wrong you'll have to resend the patches
anyway, though there are some other maintainers who like them - if in
doubt look at how patches for the subsystem are normally handled.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread