Messages in this thread | | | Date | Tue, 2 Jun 2015 10:15:16 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH 1/2] tracing: Prefer kcalloc over kzalloc with multiply |
| |
On Tue, 2 Jun 2015 16:26:28 +0300 Gil Fruchter <gilf@ezchip.com> wrote:
> fix checkpatch warning for using kzalloc with multiply: > WARNING: Prefer kcalloc over kzalloc with multiply > + iter->buffer_iter = kzalloc(sizeof(*iter->buffer_iter) > * num_possible_cpus(),
I'm not against applying this patch, but "fix checkpatch warning" is never rational for a change.
This should say something like, "Use kcalloc for allocating an array instead of a simple multiplier with kzalloc, as that is what kcalloc is used for."
In other words, if checkpatch found something that should be change, have the change log tell us why it should be changed. You can than add a "Found with checkpatch" to give checkpatch the credit.
-- Steve
> > Signed-off-by: Gil Fruchter <gilf@ezchip.com> > --- > kernel/trace/trace.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 0533049..57ffc4a 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -3034,7 +3034,7 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot) > if (!iter) > return ERR_PTR(-ENOMEM); > > - iter->buffer_iter = kzalloc(sizeof(*iter->buffer_iter) * num_possible_cpus(), > + iter->buffer_iter = kcalloc(num_possible_cpus(), sizeof(*iter->buffer_iter), > GFP_KERNEL); > if (!iter->buffer_iter) > goto release;
| |