linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Extcon: Fine-tuning for three functions
@ 2017-04-24 12:38 ` SF Markus Elfring
  2017-04-24 12:40   ` [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() SF Markus Elfring
                     ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-24 12:38 UTC (permalink / raw)
  To: patches, Chanwoo Choi, Charles Keepax, MyungJoo Ham; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 24 Apr 2017 14:26:54 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Use devm_kcalloc() in extcon_dev_register()
  Fix a typo in three comment lines
  Use devm_kcalloc() in arizona_extcon_get_micd_configs()

 drivers/extcon/extcon-arizona.c |  4 +---
 drivers/extcon/extcon.c         | 11 +++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

-- 
2.12.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register()
  2017-04-24 12:38 ` [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring
@ 2017-04-24 12:40   ` SF Markus Elfring
  2017-04-24 12:41   ` [PATCH 2/3] extcon: Fix a typo in three comment lines SF Markus Elfring
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-24 12:40 UTC (permalink / raw)
  To: patches, Chanwoo Choi, Charles Keepax, MyungJoo Ham; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Apr 2017 20:54:11 +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_kcalloc".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/extcon/extcon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index f422a78ba342..acb847bc1619 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1252,9 +1252,8 @@ int extcon_dev_register(struct extcon_dev *edev)
 	}
 
 	spin_lock_init(&edev->lock);
-
-	edev->nh = devm_kzalloc(&edev->dev,
-			sizeof(*edev->nh) * edev->max_supported, GFP_KERNEL);
+	edev->nh = devm_kcalloc(&edev->dev, edev->max_supported,
+				sizeof(*edev->nh), GFP_KERNEL);
 	if (!edev->nh) {
 		ret = -ENOMEM;
 		goto err_dev;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] extcon: Fix a typo in three comment lines
  2017-04-24 12:38 ` [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring
  2017-04-24 12:40   ` [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() SF Markus Elfring
@ 2017-04-24 12:41   ` SF Markus Elfring
  2017-04-24 12:43   ` [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs() SF Markus Elfring
  2017-05-23  9:34   ` [PATCH 0/3] Extcon: Fine-tuning for three functions Chanwoo Choi
  3 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-24 12:41 UTC (permalink / raw)
  To: patches, Chanwoo Choi, Charles Keepax, MyungJoo Ham; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Apr 2017 22:15:20 +0200

Adjust three words in this description for a function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/extcon/extcon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index acb847bc1619..8eccf7b14937 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -964,12 +964,12 @@ EXPORT_SYMBOL_GPL(extcon_unregister_notifier);
 
 /**
  * extcon_register_notifier_all() - Register a notifier block for all connectors
- * @edev:	the extcon device that has the external connecotr.
+ * @edev:	the extcon device that has the external connector.
  * @nb:		a notifier block to be registered.
  *
- * This fucntion registers a notifier block in order to receive the state
+ * This function registers a notifier block in order to receive the state
  * change of all supported external connectors from extcon device.
- * And The second parameter given to the callback of nb (val) is
+ * And the second parameter given to the callback of nb (val) is
  * the current state and third parameter is the edev pointer.
  *
  * Returns 0 if success or error number if fail
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
  2017-04-24 12:38 ` [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring
  2017-04-24 12:40   ` [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() SF Markus Elfring
  2017-04-24 12:41   ` [PATCH 2/3] extcon: Fix a typo in three comment lines SF Markus Elfring
@ 2017-04-24 12:43   ` SF Markus Elfring
  2017-04-24 13:00     ` Charles Keepax
  2017-05-23  9:34   ` [PATCH 0/3] Extcon: Fine-tuning for three functions Chanwoo Choi
  3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-24 12:43 UTC (permalink / raw)
  To: patches, Chanwoo Choi, Charles Keepax, MyungJoo Ham; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Apr 2017 22:44: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_kcalloc".

* Replace the specification of a data structure by a pointer dereference
  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/extcon/extcon-arizona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e2d78cd7030d..f84da4a17724 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1271,9 +1271,7 @@ static int arizona_extcon_get_micd_configs(struct device *dev,
 		goto out;
 
 	nconfs /= entries_per_config;
-
-	micd_configs = devm_kzalloc(dev,
-				    nconfs * sizeof(struct arizona_micd_range),
+	micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs),
 				    GFP_KERNEL);
 	if (!micd_configs) {
 		ret = -ENOMEM;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
  2017-04-24 12:43   ` [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs() SF Markus Elfring
@ 2017-04-24 13:00     ` Charles Keepax
  2017-04-24 13:34       ` SF Markus Elfring
  0 siblings, 1 reply; 8+ messages in thread
From: Charles Keepax @ 2017-04-24 13:00 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: patches, Chanwoo Choi, MyungJoo Ham, LKML, kernel-janitors

On Mon, Apr 24, 2017 at 02:43:55PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 23 Apr 2017 22:44: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_kcalloc".
> 
> * Replace the specification of a data structure by a pointer dereference
>   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>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Actually fixes a bug on the alloc as well looks like the type was
wrong before.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
  2017-04-24 13:00     ` Charles Keepax
@ 2017-04-24 13:34       ` SF Markus Elfring
  2017-04-26  8:01         ` Charles Keepax
  0 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-24 13:34 UTC (permalink / raw)
  To: Charles Keepax; +Cc: patches, Chanwoo Choi, MyungJoo Ham, LKML, kernel-janitors

> Actually fixes a bug on the alloc as well looks like the type was
> wrong before.

Does your feedback mean that the tag “Fixes” should be added
to this update suggestion?

Regards,
Markus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
  2017-04-24 13:34       ` SF Markus Elfring
@ 2017-04-26  8:01         ` Charles Keepax
  0 siblings, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2017-04-26  8:01 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: patches, Chanwoo Choi, MyungJoo Ham, LKML, kernel-janitors

On Mon, Apr 24, 2017 at 03:34:07PM +0200, SF Markus Elfring wrote:
> > Actually fixes a bug on the alloc as well looks like the type was
> > wrong before.
> 
> Does your feedback mean that the tag “Fixes” should be added
> to this update suggestion?
> 

I am happy with it as is, but there would certainly be nothing
wrong with a fixes tag.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Extcon: Fine-tuning for three functions
  2017-04-24 12:38 ` [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring
                     ` (2 preceding siblings ...)
  2017-04-24 12:43   ` [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs() SF Markus Elfring
@ 2017-05-23  9:34   ` Chanwoo Choi
  3 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2017-05-23  9:34 UTC (permalink / raw)
  To: SF Markus Elfring, patches, Charles Keepax, MyungJoo Ham
  Cc: LKML, kernel-janitors

On 2017년 04월 24일 21:38, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 24 Apr 2017 14:26:54 +0200
> 
> Three update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (3):
>   Use devm_kcalloc() in extcon_dev_register()
>   Fix a typo in three comment lines
>   Use devm_kcalloc() in arizona_extcon_get_micd_configs()
> 
>  drivers/extcon/extcon-arizona.c |  4 +---
>  drivers/extcon/extcon.c         | 11 +++++------
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 

Applied these patches.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-23  9:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170424123857epcas2p24390d04885c9fc4c1980838ed8a4db06@epcas2p2.samsung.com>
2017-04-24 12:38 ` [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring
2017-04-24 12:40   ` [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() SF Markus Elfring
2017-04-24 12:41   ` [PATCH 2/3] extcon: Fix a typo in three comment lines SF Markus Elfring
2017-04-24 12:43   ` [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs() SF Markus Elfring
2017-04-24 13:00     ` Charles Keepax
2017-04-24 13:34       ` SF Markus Elfring
2017-04-26  8:01         ` Charles Keepax
2017-05-23  9:34   ` [PATCH 0/3] Extcon: Fine-tuning for three functions Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).