linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations
@ 2017-04-25  8:40 SF Markus Elfring
  2017-04-25  8:41 ` [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-04-25  8:40 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: LKML, kernel-janitors

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

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

* [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
  2017-04-25  8:40 [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations SF Markus Elfring
@ 2017-04-25  8:41 ` SF Markus Elfring
  2017-04-25  8:42 ` [PATCH 2/3] HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-04-25  8:41 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: LKML, kernel-janitors

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

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

* [PATCH 2/3] HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions
  2017-04-25  8:40 [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations SF Markus Elfring
  2017-04-25  8:41 ` [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe() SF Markus Elfring
@ 2017-04-25  8:42 ` SF Markus Elfring
  2017-04-25  8:43 ` [PATCH 3/3] HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe() SF Markus Elfring
  2017-05-01  9:06 ` [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations Sebastian Reichel
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-04-25  8:42 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: LKML, kernel-janitors, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 10:17:06 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

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

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index f6c97a0e1fcd..a774ca7839e1 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -104,10 +104,8 @@ static int nokia_modem_gpio_probe(struct device *dev)
 
 	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");
+	if (!modem->gpios)
 		return -ENOMEM;
-	}
 
 	modem->gpio_amount = gpio_count;
 
@@ -156,10 +154,9 @@ static int nokia_modem_probe(struct device *dev)
 	}
 
 	modem = devm_kzalloc(dev, sizeof(*modem), GFP_KERNEL);
-	if (!modem) {
-		dev_err(dev, "Could not allocate memory for nokia_modem_device\n");
+	if (!modem)
 		return -ENOMEM;
-	}
+
 	dev_set_drvdata(dev, modem);
 	modem->device = dev;
 
-- 
2.12.2

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

* [PATCH 3/3] HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe()
  2017-04-25  8:40 [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations SF Markus Elfring
  2017-04-25  8:41 ` [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe() SF Markus Elfring
  2017-04-25  8:42 ` [PATCH 2/3] HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
@ 2017-04-25  8:43 ` SF Markus Elfring
  2017-05-01  9:06 ` [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations Sebastian Reichel
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-04-25  8:43 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: LKML, kernel-janitors, trivial

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 10:20:37 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: space required before the open parenthesis '('

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hsi/clients/nokia-modem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index a774ca7839e1..f78cca98266f 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -179,7 +179,7 @@ static int nokia_modem_probe(struct device *dev)
 	}
 	enable_irq_wake(irq);
 
-	if(pm) {
+	if (pm) {
 		err = nokia_modem_gpio_probe(dev);
 		if (err < 0) {
 			dev_err(dev, "Could not probe GPIOs\n");
-- 
2.12.2

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

* Re: [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations
  2017-04-25  8:40 [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-04-25  8:43 ` [PATCH 3/3] HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe() SF Markus Elfring
@ 2017-05-01  9:06 ` Sebastian Reichel
  3 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2017-05-01  9:06 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  8:40 [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations SF Markus Elfring
2017-04-25  8:41 ` [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe() SF Markus Elfring
2017-04-25  8:42 ` [PATCH 2/3] HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
2017-04-25  8:43 ` [PATCH 3/3] HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe() SF Markus Elfring
2017-05-01  9:06 ` [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations Sebastian Reichel

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).