All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] HSI: Fine-tuning for three function implementations
@ 2017-04-25 12:43 ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-25 12:43 UTC (permalink / raw)
  To: Andrew F. Davis, Carlos Chinea, Linus Walleij, Sebastian Reichel
  Cc: LKML, kernel-janitors

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

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

Markus Elfring (2):
  Use kcalloc() in hsi_register_board_info()
  core: Use kcalloc() in two functions

 drivers/hsi/hsi_boardinfo.c | 2 +-
 drivers/hsi/hsi_core.c      | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.12.2

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

* [PATCH 0/2] HSI: Fine-tuning for three function implementations
@ 2017-04-25 12:43 ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-25 12:43 UTC (permalink / raw)
  To: Andrew F. Davis, Carlos Chinea, Linus Walleij, Sebastian Reichel
  Cc: LKML, kernel-janitors

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

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

Markus Elfring (2):
  Use kcalloc() in hsi_register_board_info()
  core: Use kcalloc() in two functions

 drivers/hsi/hsi_boardinfo.c | 2 +-
 drivers/hsi/hsi_core.c      | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.12.2


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

* [PATCH 1/2] HSI: Use kcalloc() in hsi_register_board_info()
  2017-04-25 12:43 ` SF Markus Elfring
@ 2017-04-25 12:45   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-25 12:45 UTC (permalink / raw)
  To: Andrew F. Davis, Carlos Chinea, Linus Walleij, Sebastian Reichel
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 13:56:08 +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 "kcalloc".

This issue was detected by using the Coccinelle software.

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

diff --git a/drivers/hsi/hsi_boardinfo.c b/drivers/hsi/hsi_boardinfo.c
index e56bc6da5f98..e381cb4c962e 100644
--- a/drivers/hsi/hsi_boardinfo.c
+++ b/drivers/hsi/hsi_boardinfo.c
@@ -49,7 +49,7 @@ int __init hsi_register_board_info(struct hsi_board_info const *info,
 {
 	struct hsi_cl_info *cl_info;
 
-	cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL);
+	cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL);
 	if (!cl_info)
 		return -ENOMEM;
 
-- 
2.12.2

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

* [PATCH 1/2] HSI: Use kcalloc() in hsi_register_board_info()
@ 2017-04-25 12:45   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-25 12:45 UTC (permalink / raw)
  To: Andrew F. Davis, Carlos Chinea, Linus Walleij, Sebastian Reichel
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 13:56:08 +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 "kcalloc".

This issue was detected by using the Coccinelle software.

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

diff --git a/drivers/hsi/hsi_boardinfo.c b/drivers/hsi/hsi_boardinfo.c
index e56bc6da5f98..e381cb4c962e 100644
--- a/drivers/hsi/hsi_boardinfo.c
+++ b/drivers/hsi/hsi_boardinfo.c
@@ -49,7 +49,7 @@ int __init hsi_register_board_info(struct hsi_board_info const *info,
 {
 	struct hsi_cl_info *cl_info;
 
-	cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL);
+	cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL);
 	if (!cl_info)
 		return -ENOMEM;
 
-- 
2.12.2


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

* [PATCH 2/2] HSI: core: Use kcalloc() in two functions
  2017-04-25 12:43 ` SF Markus Elfring
@ 2017-04-25 12:46   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-25 12:46 UTC (permalink / raw)
  To: Andrew F. Davis, Carlos Chinea, Linus Walleij, Sebastian Reichel
  Cc: LKML, kernel-janitors

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

Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

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

diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c
index c2a2a9795b0b..9065efd21851 100644
--- a/drivers/hsi/hsi_core.c
+++ b/drivers/hsi/hsi_core.c
@@ -267,14 +267,13 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
 
 	cl->rx_cfg.num_channels = cells;
 	cl->tx_cfg.num_channels = cells;
-
-	cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL);
+	cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
 	if (!cl->rx_cfg.channels) {
 		err = -ENOMEM;
 		goto err;
 	}
 
-	cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL);
+	cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
 	if (!cl->tx_cfg.channels) {
 		err = -ENOMEM;
 		goto err2;
@@ -485,7 +484,7 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags)
 	hsi = kzalloc(sizeof(*hsi), flags);
 	if (!hsi)
 		return NULL;
-	port = kzalloc(sizeof(*port)*n_ports, flags);
+	port = kcalloc(n_ports, sizeof(*port), flags);
 	if (!port) {
 		kfree(hsi);
 		return NULL;
-- 
2.12.2

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

* [PATCH 2/2] HSI: core: Use kcalloc() in two functions
@ 2017-04-25 12:46   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-04-25 12:46 UTC (permalink / raw)
  To: Andrew F. Davis, Carlos Chinea, Linus Walleij, Sebastian Reichel
  Cc: LKML, kernel-janitors

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

Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

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

diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c
index c2a2a9795b0b..9065efd21851 100644
--- a/drivers/hsi/hsi_core.c
+++ b/drivers/hsi/hsi_core.c
@@ -267,14 +267,13 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
 
 	cl->rx_cfg.num_channels = cells;
 	cl->tx_cfg.num_channels = cells;
-
-	cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL);
+	cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
 	if (!cl->rx_cfg.channels) {
 		err = -ENOMEM;
 		goto err;
 	}
 
-	cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL);
+	cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
 	if (!cl->tx_cfg.channels) {
 		err = -ENOMEM;
 		goto err2;
@@ -485,7 +484,7 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags)
 	hsi = kzalloc(sizeof(*hsi), flags);
 	if (!hsi)
 		return NULL;
-	port = kzalloc(sizeof(*port)*n_ports, flags);
+	port = kcalloc(n_ports, sizeof(*port), flags);
 	if (!port) {
 		kfree(hsi);
 		return NULL;
-- 
2.12.2


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

* Re: [PATCH 0/2] HSI: Fine-tuning for three function implementations
  2017-04-25 12:43 ` SF Markus Elfring
@ 2017-05-01  9:08   ` Sebastian Reichel
  -1 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2017-05-01  9:08 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: LKML, kernel-janitors

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

Hi,

On Tue, Apr 25, 2017 at 02:43:25PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Apr 2017 14:32:10 +0200
> 
> Two update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (2):
>   Use kcalloc() in hsi_register_board_info()
>   core: Use kcalloc() in two functions
> 
>  drivers/hsi/hsi_boardinfo.c | 2 +-
>  drivers/hsi/hsi_core.c      | 7 +++----
>  2 files changed, 4 insertions(+), 5 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] 8+ messages in thread

* Re: [PATCH 0/2] HSI: Fine-tuning for three function implementations
@ 2017-05-01  9:08   ` Sebastian Reichel
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2017-05-01  9:08 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: LKML, kernel-janitors

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

Hi,

On Tue, Apr 25, 2017 at 02:43:25PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Apr 2017 14:32:10 +0200
> 
> Two update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (2):
>   Use kcalloc() in hsi_register_board_info()
>   core: Use kcalloc() in two functions
> 
>  drivers/hsi/hsi_boardinfo.c | 2 +-
>  drivers/hsi/hsi_core.c      | 7 +++----
>  2 files changed, 4 insertions(+), 5 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] 8+ messages in thread

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 12:43 [PATCH 0/2] HSI: Fine-tuning for three function implementations SF Markus Elfring
2017-04-25 12:43 ` SF Markus Elfring
2017-04-25 12:45 ` [PATCH 1/2] HSI: Use kcalloc() in hsi_register_board_info() SF Markus Elfring
2017-04-25 12:45   ` SF Markus Elfring
2017-04-25 12:46 ` [PATCH 2/2] HSI: core: Use kcalloc() in two functions SF Markus Elfring
2017-04-25 12:46   ` SF Markus Elfring
2017-05-01  9:08 ` [PATCH 0/2] HSI: Fine-tuning for three function implementations Sebastian Reichel
2017-05-01  9:08   ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.