Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752424AbbFVONM (ORCPT ); Mon, 22 Jun 2015 10:13:12 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:38506 "EHLO e06smtp11.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954AbbFVOND (ORCPT ); Mon, 22 Jun 2015 10:13:03 -0400 X-Helo: d06dlp02.portsmouth.uk.ibm.com X-MailFrom: oberpar@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Message-ID: <55881805.8040209@linux.vnet.ibm.com> Date: Mon, 22 Jun 2015 16:13:25 +0200 From: Peter Oberparleiter MIME-Version: 1.0 To: Maninder Singh , linux-kernel@vger.kernel.org, shanky.cool1992@gmail.com CC: pankaj.m@samsung.com Subject: Re: [Resend PATCH 1/1] kernel/gcov/fs.c: Use kzalloc for allocating one thing References: <1434979459-30970-1-git-send-email-maninder1.s@samsung.com> In-Reply-To: <1434979459-30970-1-git-send-email-maninder1.s@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15062214-0041-0000-0000-000004D88476 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1266 Lines: 39 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 > Reviewed-by: Vaneet Narang > --- > 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/