* [PATCH 0/2] regulator: s2mps11: Fine-tuning for s2mps11_pmic_probe()
@ 2017-04-14 21:00 ` SF Markus Elfring
0 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-14 21:00 UTC (permalink / raw)
To: linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Sangbeom Kim
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 22:55:22 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use kcalloc()
Use devm_kmalloc_array()
drivers/regulator/s2mps11.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--
2.12.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/2] regulator: s2mps11: Fine-tuning for s2mps11_pmic_probe()
@ 2017-04-14 21:00 ` SF Markus Elfring
0 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-14 21:00 UTC (permalink / raw)
To: linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Sangbeom Kim
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 22:55:22 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use kcalloc()
Use devm_kmalloc_array()
drivers/regulator/s2mps11.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--
2.12.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe()
2017-04-14 21:00 ` SF Markus Elfring
@ 2017-04-14 21:01 ` SF Markus Elfring
-1 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-14 21:01 UTC (permalink / raw)
To: linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Sangbeom Kim
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 22:00:35 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/regulator/s2mps11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 7726b874e539..b4e588cce03d 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
}
}
- rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL);
+ rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
if (!rdata)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/2] regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe()
@ 2017-04-14 21:01 ` SF Markus Elfring
0 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-14 21:01 UTC (permalink / raw)
To: linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Sangbeom Kim
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 22:00:35 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/regulator/s2mps11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 7726b874e539..b4e588cce03d 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
}
}
- rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL);
+ rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
if (!rdata)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] regulator: s2mps11: Use devm_kmalloc_array() in s2mps11_pmic_probe()
2017-04-14 21:00 ` SF Markus Elfring
@ 2017-04-14 21:02 ` SF Markus Elfring
-1 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-14 21:02 UTC (permalink / raw)
To: linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Sangbeom Kim
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 22:40:19 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/regulator/s2mps11.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index b4e588cce03d..b397a2e0bcd1 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1139,9 +1139,11 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
return -EINVAL;
}
- s2mps11->ext_control_gpio = devm_kmalloc(&pdev->dev,
- sizeof(*s2mps11->ext_control_gpio) * rdev_num,
- GFP_KERNEL);
+ s2mps11->ext_control_gpio
+ = devm_kmalloc_array(&pdev->dev,
+ rdev_num,
+ sizeof(*s2mps11->ext_control_gpio),
+ GFP_KERNEL);
if (!s2mps11->ext_control_gpio)
return -ENOMEM;
/*
--
2.12.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] regulator: s2mps11: Use devm_kmalloc_array() in s2mps11_pmic_probe()
@ 2017-04-14 21:02 ` SF Markus Elfring
0 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-14 21:02 UTC (permalink / raw)
To: linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Sangbeom Kim
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 22:40:19 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/regulator/s2mps11.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index b4e588cce03d..b397a2e0bcd1 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1139,9 +1139,11 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
return -EINVAL;
}
- s2mps11->ext_control_gpio = devm_kmalloc(&pdev->dev,
- sizeof(*s2mps11->ext_control_gpio) * rdev_num,
- GFP_KERNEL);
+ s2mps11->ext_control_gpio
+ = devm_kmalloc_array(&pdev->dev,
+ rdev_num,
+ sizeof(*s2mps11->ext_control_gpio),
+ GFP_KERNEL);
if (!s2mps11->ext_control_gpio)
return -ENOMEM;
/*
--
2.12.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe()
2017-04-14 21:01 ` SF Markus Elfring
@ 2017-04-15 10:48 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2017-04-15 10:48 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-samsung-soc, Bartlomiej Zolnierkiewicz, Liam Girdwood,
Mark Brown, Sangbeom Kim, LKML, kernel-janitors
On Fri, Apr 14, 2017 at 11:01:25PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 14 Apr 2017 22:00:35 +0200
>
> A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kcalloc".
>
> This issue was detected by using the Coccinelle software.
Unfortunately you write mostly cryptic commit messages. This does not
answer for the main question - why this change is needed. Code looks
okay, but you should explain in simple words why this is needed.
Best regards,
Krzysztof
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/regulator/s2mps11.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> index 7726b874e539..b4e588cce03d 100644
> --- a/drivers/regulator/s2mps11.c
> +++ b/drivers/regulator/s2mps11.c
> @@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
> }
> }
>
> - rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL);
> + rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
> if (!rdata)
> return -ENOMEM;
>
> --
> 2.12.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe()
@ 2017-04-15 10:48 ` Krzysztof Kozlowski
0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2017-04-15 10:48 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-samsung-soc, Bartlomiej Zolnierkiewicz, Liam Girdwood,
Mark Brown, Sangbeom Kim, LKML, kernel-janitors
On Fri, Apr 14, 2017 at 11:01:25PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 14 Apr 2017 22:00:35 +0200
>
> A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kcalloc".
>
> This issue was detected by using the Coccinelle software.
Unfortunately you write mostly cryptic commit messages. This does not
answer for the main question - why this change is needed. Code looks
okay, but you should explain in simple words why this is needed.
Best regards,
Krzysztof
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/regulator/s2mps11.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> index 7726b874e539..b4e588cce03d 100644
> --- a/drivers/regulator/s2mps11.c
> +++ b/drivers/regulator/s2mps11.c
> @@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
> }
> }
>
> - rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL);
> + rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
> if (!rdata)
> return -ENOMEM;
>
> --
> 2.12.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe()
2017-04-15 10:48 ` Krzysztof Kozlowski
@ 2017-04-15 17:29 ` SF Markus Elfring
-1 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-15 17:29 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: linux-samsung-soc, Bartlomiej Zolnierkiewicz, Liam Girdwood,
Mark Brown, Sangbeom Kim, LKML, kernel-janitors
>> A multiplication for the size determination of a memory allocation
>> indicated that an array data structure should be processed.
>> Thus use the corresponding function "kcalloc".
>>
>> This issue was detected by using the Coccinelle software.
>
> Unfortunately you write mostly cryptic commit messages.
Thanks for your feedback.
> This does not answer for the main question - why this change is needed.
My update suggestion affects an aspect for the coding style.
> Code looks okay,
There can be different opinions about related implementation details.
> but you should explain in simple words why this is needed.
Do you find the following wording from the script “checkpatch.pl”
better to understand?
WARNING: Prefer kcalloc over kzalloc with multiply
Regards,
Markus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe()
@ 2017-04-15 17:29 ` SF Markus Elfring
0 siblings, 0 replies; 10+ messages in thread
From: SF Markus Elfring @ 2017-04-15 17:29 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: linux-samsung-soc, Bartlomiej Zolnierkiewicz, Liam Girdwood,
Mark Brown, Sangbeom Kim, LKML, kernel-janitors
>> A multiplication for the size determination of a memory allocation
>> indicated that an array data structure should be processed.
>> Thus use the corresponding function "kcalloc".
>>
>> This issue was detected by using the Coccinelle software.
>
> Unfortunately you write mostly cryptic commit messages.
Thanks for your feedback.
> This does not answer for the main question - why this change is needed.
My update suggestion affects an aspect for the coding style.
> Code looks okay,
There can be different opinions about related implementation details.
> but you should explain in simple words why this is needed.
Do you find the following wording from the script “checkpatch.pl”
better to understand?
WARNING: Prefer kcalloc over kzalloc with multiply
Regards,
Markus
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-04-15 17:29 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 21:00 [PATCH 0/2] regulator: s2mps11: Fine-tuning for s2mps11_pmic_probe() SF Markus Elfring
2017-04-14 21:00 ` SF Markus Elfring
2017-04-14 21:01 ` [PATCH 1/2] regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe() SF Markus Elfring
2017-04-14 21:01 ` SF Markus Elfring
2017-04-15 10:48 ` Krzysztof Kozlowski
2017-04-15 10:48 ` Krzysztof Kozlowski
2017-04-15 17:29 ` SF Markus Elfring
2017-04-15 17:29 ` SF Markus Elfring
2017-04-14 21:02 ` [PATCH 2/2] regulator: s2mps11: Use devm_kmalloc_array() " SF Markus Elfring
2017-04-14 21:02 ` SF Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.