linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Resend PATCH 1/1] kernel/gcov/fs.c: Use kzalloc for allocating one thing
@ 2015-06-22 13:24 Maninder Singh
  2015-06-22 14:13 ` Peter Oberparleiter
  0 siblings, 1 reply; 2+ messages in thread
From: Maninder Singh @ 2015-06-22 13:24 UTC (permalink / raw)
  To: oberpar, linux-kernel, shanky.cool1992; +Cc: pankaj.m, Maninder Singh

Use kzalloc rather than kcalloc(1.. for allocation
of one thing.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Vaneet Narang <v.narang@samsung.com>
---
 kernel/gcov/fs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index edf67c4..b31701a 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -437,7 +437,7 @@ static struct gcov_node *new_node(struct gcov_node *parent,
 	if (!node)
 		goto err_nomem;
 	if (info) {
-		node->loaded_info = kcalloc(1, sizeof(struct gcov_info *),
+		node->loaded_info = kzalloc(sizeof(struct gcov_info *),
 					   GFP_KERNEL);
 		if (!node->loaded_info)
 			goto err_nomem;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [Resend PATCH 1/1] kernel/gcov/fs.c: Use kzalloc for allocating one thing
  2015-06-22 13:24 [Resend PATCH 1/1] kernel/gcov/fs.c: Use kzalloc for allocating one thing Maninder Singh
@ 2015-06-22 14:13 ` Peter Oberparleiter
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Oberparleiter @ 2015-06-22 14:13 UTC (permalink / raw)
  To: Maninder Singh, linux-kernel, shanky.cool1992; +Cc: pankaj.m

On 22.06.2015 15:24, Maninder Singh wrote:
> Use kzalloc rather than kcalloc(1.. for allocation
> of one thing.
> 
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> Reviewed-by: Vaneet Narang <v.narang@samsung.com>
> ---
>  kernel/gcov/fs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
> index edf67c4..b31701a 100644
> --- a/kernel/gcov/fs.c
> +++ b/kernel/gcov/fs.c
> @@ -437,7 +437,7 @@ static struct gcov_node *new_node(struct gcov_node *parent,
>  	if (!node)
>  		goto err_nomem;
>  	if (info) {
> -		node->loaded_info = kcalloc(1, sizeof(struct gcov_info *),
> +		node->loaded_info = kzalloc(sizeof(struct gcov_info *),

Using kcalloc makes it more obvious to readers that the entity being
allocated is in fact an array, even if it starts out with only one
element. This implicit bit of information would be lost when using
kzalloc. Therefore I'd like to keep the current version for better
readability.

>  					   GFP_KERNEL);
>  		if (!node->loaded_info)
>  			goto err_nomem;
> 

-- 
Peter Oberparleiter
Linux on z Systems Development - IBM Germany

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2015-06-22 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 13:24 [Resend PATCH 1/1] kernel/gcov/fs.c: Use kzalloc for allocating one thing Maninder Singh
2015-06-22 14:13 ` Peter Oberparleiter

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