Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1629483 > unrolled thread

[PATCH 0/3] Extcon: Fine-tuning for three functions

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-24 14:40 +0200
Last post2017-04-24 14:50 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 14:40 +0200
    [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in  arizona_extcon_get_micd_configs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 14:50 +0200
      Re: [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in  arizona_extcon_get_micd_configs() Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-04-24 15:00 +0200
        Re: extcon: arizona: Use devm_kcalloc() in  arizona_extcon_get_micd_configs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 15:40 +0200
    [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 14:50 +0200
    [PATCH 2/3] extcon: Fix a typo in three comment lines SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 14:50 +0200

#1629483 — [PATCH 0/3] Extcon: Fine-tuning for three functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-24 14:40 +0200
Subject[PATCH 0/3] Extcon: Fine-tuning for three functions
Message-ID<tzLrA-6Zn-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1629494 — [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-24 14:50 +0200
Subject[PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
Message-ID<tzLBg-72B-11@gated-at.bofh.it>
In reply to#1629483
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

[toc] | [prev] | [next] | [standalone]


#1629508 — Re: [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2017-04-24 15:00 +0200
SubjectRe: [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
Message-ID<tzLKW-75O-9@gated-at.bofh.it>
In reply to#1629494
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

[toc] | [prev] | [next] | [standalone]


#1629574 — Re: extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-24 15:40 +0200
SubjectRe: extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
Message-ID<tzMnE-7Bg-23@gated-at.bofh.it>
In reply to#1629508
> 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

[toc] | [prev] | [next] | [standalone]


#1629495 — [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-24 14:50 +0200
Subject[PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register()
Message-ID<tzLBg-72B-13@gated-at.bofh.it>
In reply to#1629483
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

[toc] | [prev] | [next] | [standalone]


#1629504 — [PATCH 2/3] extcon: Fix a typo in three comment lines

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-24 14:50 +0200
Subject[PATCH 2/3] extcon: Fix a typo in three comment lines
Message-ID<tzLBh-72B-33@gated-at.bofh.it>
In reply to#1629483
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web