mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* CodingStyle:  "kzalloc()" versus "kcalloc(1,...)"
@ 2006-12-08  0:16 Robert P. J. Day
  2006-12-13 16:39 ` Adrian Bunk
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2006-12-08  0:16 UTC (permalink / raw)
  To: Linux kernel mailing list


  i just noticed that there are numerous invocations of kcalloc()
where the hard-coded first arg of # elements is "1", which seems like
an inappropriate use of kcalloc().

  the only rationale i can see is that kcalloc() guarantees that the
memory will be set to zero, so i'm guessing that this form of
kcalloc() was used before kzalloc() existed, or was used by folks who
didn't know that kzalloc() existed.

  if a (zero-filled) single struct is being allocated, is it worth
codifying that that allocation should use kzalloc() and not
kcalloc(1,...)?

rday

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

end of thread, other threads:[~2006-12-13 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-08  0:16 CodingStyle: "kzalloc()" versus "kcalloc(1,...)" Robert P. J. Day
2006-12-13 16:39 ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®