From: Dan Carpenter <dan.carpenter@oracle.com>
To: Richard Gong <richard.gong@linux.intel.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
gregkh@linuxfoundation.org, atull@kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 4/4 v2] firmware: stratix10-svc: Slightly simplify code
Date: Wed, 06 May 2020 10:04:53 +0000 [thread overview]
Message-ID: <20200506100453.GA9365@kadam> (raw)
In-Reply-To: <1f8ae50d-6830-7fbb-e999-3e8110fe7cd6@linux.intel.com>
On Fri, May 01, 2020 at 10:40:20AM -0500, Richard Gong wrote:
> Hi,
>
> On 4/29/20 1:52 AM, Christophe JAILLET wrote:
> > Replace 'devm_kmalloc_array(... | __GFP_ZERO)' with the equivalent and
> > shorter 'devm_kcalloc(...)'.
> >
> It doesn't make much sense.
> Actually devm_kcalloc returns devm_kmalloc_array(.., flag | __GFP_ZERO).
>
devm_kcalloc() is better style and easier to read. I was just reading
a bunch of AMD code that does this and I almost complained to them
that devm_kmalloc_array() doesn't zero the memory so they were freeing
uninitialized pointers.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Richard Gong <richard.gong@linux.intel.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
gregkh@linuxfoundation.org, atull@kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 4/4 v2] firmware: stratix10-svc: Slightly simplify code
Date: Wed, 6 May 2020 13:04:53 +0300 [thread overview]
Message-ID: <20200506100453.GA9365@kadam> (raw)
In-Reply-To: <1f8ae50d-6830-7fbb-e999-3e8110fe7cd6@linux.intel.com>
On Fri, May 01, 2020 at 10:40:20AM -0500, Richard Gong wrote:
> Hi,
>
> On 4/29/20 1:52 AM, Christophe JAILLET wrote:
> > Replace 'devm_kmalloc_array(... | __GFP_ZERO)' with the equivalent and
> > shorter 'devm_kcalloc(...)'.
> >
> It doesn't make much sense.
> Actually devm_kcalloc returns devm_kmalloc_array(.., flag | __GFP_ZERO).
>
devm_kcalloc() is better style and easier to read. I was just reading
a bunch of AMD code that does this and I almost complained to them
that devm_kmalloc_array() doesn't zero the memory so they were freeing
uninitialized pointers.
regards,
dan carpenter
next prev parent reply other threads:[~2020-05-06 10:04 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 6:52 [PATCH 0/4 v2] firmware: stratix10-svc: Fix some error handling code Christophe JAILLET
2020-04-29 6:52 ` Christophe JAILLET
2020-04-29 6:52 ` [PATCH 1/4 v2] firmware: stratix10-svc: Fix genpool creation error handling Christophe JAILLET
2020-04-29 6:52 ` Christophe JAILLET
2020-04-29 9:50 ` Markus Elfring
2020-04-29 9:50 ` Markus Elfring
2020-04-29 6:52 ` [PATCH 2/4 v2] firmware: stratix10-svc: Unmap some previously memremap'ed memory Christophe JAILLET
2020-04-29 6:52 ` Christophe JAILLET
2020-05-05 14:43 ` Greg KH
2020-05-05 14:43 ` Greg KH
2020-05-05 15:09 ` Christophe JAILLET
2020-05-05 15:09 ` Christophe JAILLET
2020-04-29 6:52 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in 'stratix10_svc_drv_probe()' Christophe JAILLET
2020-04-29 6:52 ` Christophe JAILLET
2020-04-29 11:51 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in stratix10_svc_drv_probe Markus Elfring
2020-04-29 11:51 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in stratix10_svc_drv_probe() Markus Elfring
2020-05-05 13:46 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in 'stratix10_svc_drv_prob Richard Gong
2020-05-05 14:02 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in 'stratix10_svc_drv_probe()' Richard Gong
2020-05-05 15:15 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in 'stratix10_svc_drv_prob Christophe JAILLET
2020-05-05 15:15 ` [PATCH 3/4 v2] firmware: stratix10-svc: Fix some error handling paths in 'stratix10_svc_drv_probe()' Christophe JAILLET
2020-06-26 19:37 ` [PATCH V3] firmware: stratix10-svc: Fix some error handling code Christophe JAILLET
2020-06-26 19:37 ` Christophe JAILLET
2020-06-27 5:15 ` Greg KH
2020-06-27 5:15 ` Greg KH
2020-06-27 5:15 ` Greg KH
2020-06-27 5:15 ` Greg KH
2020-06-27 7:31 ` Marion & Christophe JAILLET
2020-06-27 7:31 ` Marion & Christophe JAILLET
2020-06-27 8:03 ` Greg KH
2020-06-27 8:03 ` Greg KH
2020-04-29 6:52 ` [PATCH 4/4 v2] firmware: stratix10-svc: Slightly simplify code Christophe JAILLET
2020-04-29 6:52 ` Christophe JAILLET
2020-04-29 12:41 ` Markus Elfring
2020-04-29 12:41 ` Markus Elfring
2020-05-01 15:40 ` Richard Gong
2020-05-01 15:40 ` Richard Gong
2020-05-01 15:48 ` Christophe JAILLET
2020-05-01 15:48 ` Christophe JAILLET
2020-05-01 16:55 ` Richard Gong
2020-05-01 16:55 ` Richard Gong
2020-05-02 8:49 ` Christophe JAILLET
2020-05-02 8:49 ` Christophe JAILLET
2020-05-05 14:18 ` Richard Gong
2020-05-05 14:18 ` Richard Gong
2020-05-06 10:04 ` Dan Carpenter [this message]
2020-05-06 10:04 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200506100453.GA9365@kadam \
--to=dan.carpenter@oracle.com \
--cc=atull@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.gong@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.