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


Groups > linux.kernel > #1630307 > unrolled thread

[PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-25 10:50 +0200
Last post2017-05-01 11:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 10:50 +0200
    [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in  nokia_modem_gpio_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 10:50 +0200
    Re: [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function  implementations Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-01 11:10 +0200

#1630307 — [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-25 10:50 +0200
Subject[PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations
Message-ID<tA4ky-2l1-13@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 10:36:54 +0200

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

Markus Elfring (3):
  Use devm_kcalloc() in nokia_modem_gpio_probe()
  Delete error messages for a failed memory allocation in two functions
  Add a space character for better code readability in nokia_modem_probe()

 drivers/hsi/clients/nokia-modem.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

-- 
2.12.2

[toc] | [next] | [standalone]


#1630308 — [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-25 10:50 +0200
Subject[PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
Message-ID<tA4ky-2l1-23@gated-at.bofh.it>
In reply to#1630307
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 09:49:22 +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".

  This issue was detected by using the Coccinelle software.

* 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/hsi/clients/nokia-modem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index c000780d931f..f6c97a0e1fcd 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev)
 		return -EINVAL;
 	}
 
-	modem->gpios = devm_kzalloc(dev, gpio_count *
-				sizeof(struct nokia_modem_gpio), GFP_KERNEL);
+	modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios),
+				    GFP_KERNEL);
 	if (!modem->gpios) {
 		dev_err(dev, "Could not allocate memory for gpios\n");
 		return -ENOMEM;
-- 
2.12.2

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


#1633583

FromSebastian Reichel <sebastian.reichel@collabora.co.uk>
Date2017-05-01 11:10 +0200
Message-ID<tCfvc-7cA-27@gated-at.bofh.it>
In reply to#1630307

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Tue, Apr 25, 2017 at 10:40:10AM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Apr 2017 10:36:54 +0200
> 
> Three update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (3):
>   Use devm_kcalloc() in nokia_modem_gpio_probe()
>   Delete error messages for a failed memory allocation in two functions
>   Add a space character for better code readability in nokia_modem_probe()
> 
>  drivers/hsi/clients/nokia-modem.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)

Thanks for your patchset. We are currently in the merge
window and your patch will appear in linux-next once
4.12-rc1 has been tagged by Linus Torvalds.

Until then I queued it into this branch:

https://git.kernel.org/cgit/linux/kernel/git/sre/linux-hsi.git/log/?h=for-next-next

-- Sebastian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web