linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations
@ 2017-04-25 11:12 SF Markus Elfring
  2017-04-25 11:15 ` [PATCH 1/3] HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-04-25 11:12 UTC (permalink / raw)
  To: Arnd Bergmann, Pavel Machek, Sebastian Reichel, Tony Lindgren
  Cc: LKML, kernel-janitors

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

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

Markus Elfring (3):
  Use devm_kcalloc() in ssi_add_controller()
  Fix a typo in a comment line
  Delete an error message for a failed memory allocation in ssi_add_controller()

 drivers/hsi/controllers/omap_ssi_core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.12.2

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

* [PATCH 1/3] HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller()
  2017-04-25 11:12 [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations SF Markus Elfring
@ 2017-04-25 11:15 ` SF Markus Elfring
  2017-04-25 11:16 ` [PATCH 2/3] HSI: omap_ssi: Fix a typo in a comment line SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-04-25 11:15 UTC (permalink / raw)
  To: Arnd Bergmann, Pavel Machek, Sebastian Reichel, Tony Lindgren
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 11:20:41 +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 type 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/controllers/omap_ssi_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index 9a29b34ed2c8..464db6d33afb 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -421,8 +421,8 @@ static int ssi_add_controller(struct hsi_controller *ssi,
 		goto out_err;
 	}
 
-	omap_ssi->port = devm_kzalloc(&ssi->device,
-		sizeof(struct omap_ssi_port *) * ssi->num_ports, GFP_KERNEL);
+	omap_ssi->port = devm_kcalloc(&ssi->device, ssi->num_ports,
+				      sizeof(*omap_ssi->port), GFP_KERNEL);
 	if (!omap_ssi->port) {
 		err = -ENOMEM;
 		goto out_err;
-- 
2.12.2

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

* [PATCH 2/3] HSI: omap_ssi: Fix a typo in a comment line
  2017-04-25 11:12 [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations SF Markus Elfring
  2017-04-25 11:15 ` [PATCH 1/3] HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller() SF Markus Elfring
@ 2017-04-25 11:16 ` SF Markus Elfring
  2017-04-25 11:18 ` [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller() SF Markus Elfring
  2017-05-01  9:07 ` [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations Sebastian Reichel
  3 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-04-25 11:16 UTC (permalink / raw)
  To: Arnd Bergmann, Pavel Machek, Sebastian Reichel, Tony Lindgren
  Cc: LKML, kernel-janitors

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

Add a missing character in this description for a function call.

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

diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index 464db6d33afb..fb7ed8fce83a 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -467,7 +467,7 @@ static int ssi_hw_init(struct hsi_controller *ssi)
 		dev_err(&ssi->device, "runtime PM failed %d\n", err);
 		return err;
 	}
-	/* Reseting GDD */
+	/* Resetting GDD */
 	writel_relaxed(SSI_SWRESET, omap_ssi->gdd + SSI_GDD_GRST_REG);
 	/* Get FCK rate in KHz */
 	omap_ssi->fck_rate = DIV_ROUND_CLOSEST(ssi_get_clk_rate(ssi), 1000);
-- 
2.12.2

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

* [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
  2017-04-25 11:12 [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations SF Markus Elfring
  2017-04-25 11:15 ` [PATCH 1/3] HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller() SF Markus Elfring
  2017-04-25 11:16 ` [PATCH 2/3] HSI: omap_ssi: Fix a typo in a comment line SF Markus Elfring
@ 2017-04-25 11:18 ` SF Markus Elfring
  2017-04-25 11:54   ` Pavel Machek
  2017-05-01  9:07 ` [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations Sebastian Reichel
  3 siblings, 1 reply; 7+ messages in thread
From: SF Markus Elfring @ 2017-04-25 11:18 UTC (permalink / raw)
  To: Arnd Bergmann, Pavel Machek, Sebastian Reichel, Tony Lindgren
  Cc: LKML, kernel-janitors, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 12:42:14 +0200

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

WARNING: Possible unnecessary 'out of memory' message

Thus remove such a statement 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/controllers/omap_ssi_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index fb7ed8fce83a..88e48b346916 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -384,10 +384,8 @@ static int ssi_add_controller(struct hsi_controller *ssi,
 	int err;
 
 	omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL);
-	if (!omap_ssi) {
-		dev_err(&pd->dev, "not enough memory for omap ssi\n");
+	if (!omap_ssi)
 		return -ENOMEM;
-	}
 
 	err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL);
 	if (err < 0)
-- 
2.12.2

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

* Re: [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
  2017-04-25 11:18 ` [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller() SF Markus Elfring
@ 2017-04-25 11:54   ` Pavel Machek
  2017-04-25 12:32     ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2017-04-25 11:54 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-kernel, kernel-janitors

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

On Tue 2017-04-25 13:18:31, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Apr 2017 12:42:14 +0200
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> WARNING: Possible unnecessary 'out of memory' message
> 
> Thus remove such a statement here.

Any reason to believe it is good idea besides program telling you it
_might_ be?
								Pavel
								
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
  2017-04-25 11:54   ` Pavel Machek
@ 2017-04-25 12:32     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2017-04-25 12:32 UTC (permalink / raw)
  To: Pavel Machek; +Cc: SF Markus Elfring, linux-kernel, kernel-janitors

1) That allocation will never fail in real life so it's dead code.
2) kmalloc and friends already have much better builtin in error
   messages so it's useless.
3) There is a small memory savings from removing it.

I'm not saying you should apply the patch, I'm just saying that these
messages are pointless and detrimental.

regards,
an carpenter

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

* Re: [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations
  2017-04-25 11:12 [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-04-25 11:18 ` [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller() SF Markus Elfring
@ 2017-05-01  9:07 ` Sebastian Reichel
  3 siblings, 0 replies; 7+ messages in thread
From: Sebastian Reichel @ 2017-05-01  9:07 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Arnd Bergmann, Pavel Machek, Tony Lindgren, LKML, kernel-janitors

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

Hi,

On Tue, Apr 25, 2017 at 01:12:42PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Apr 2017 12:52:10 +0200
> 
> Three update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (3):
>   Use devm_kcalloc() in ssi_add_controller()
>   Fix a typo in a comment line
>   Delete an error message for a failed memory allocation in ssi_add_controller()
> 
>  drivers/hsi/controllers/omap_ssi_core.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 11:12 [PATCH 0/3] HSI: omap_ssi: Fine-tuning for two function implementations SF Markus Elfring
2017-04-25 11:15 ` [PATCH 1/3] HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller() SF Markus Elfring
2017-04-25 11:16 ` [PATCH 2/3] HSI: omap_ssi: Fix a typo in a comment line SF Markus Elfring
2017-04-25 11:18 ` [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller() SF Markus Elfring
2017-04-25 11:54   ` Pavel Machek
2017-04-25 12:32     ` Dan Carpenter
2017-05-01  9:07 ` [PATCH 0/3] HSI: omap_ssi: 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).