mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
@ 2006-12-08 23:41 Robert P. J. Day
  2006-12-09 13:53 ` Pekka Enberg
  0 siblings, 1 reply; 12+ messages in thread
From: Robert P. J. Day @ 2006-12-08 23:41 UTC (permalink / raw)
  To: Linux kernel mailing list


  Some calls to kcalloc() appear to have the first two args in the
wrong order.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>

---

 drivers/macintosh/smu.c             |    2 +-
 drivers/net/skge.c                  |    2 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.c |    2 +-
 drivers/usb/misc/uss720.c           |    2 +-
 net/sunrpc/svc.c                    |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 6dde27a..8c36894 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -945,7 +945,7 @@ static struct smu_sdbp_header *smu_creat
 	 */
 	tlen = sizeof(struct property) + len + 18;

-	prop = kcalloc(tlen, 1, GFP_KERNEL);
+	prop = kcalloc(1, tlen, GFP_KERNEL);
 	if (prop == NULL)
 		return NULL;
 	hdr = (struct smu_sdbp_header *)(prop + 1);
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b60f045..8a39376 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -749,7 +749,7 @@ static int skge_ring_alloc(struct skge_r
 	struct skge_element *e;
 	int i;

-	ring->start = kcalloc(sizeof(*e), ring->count, GFP_KERNEL);
+	ring->start = kcalloc(ring->count, sizeof(*e), GFP_KERNEL);
 	if (!ring->start)
 		return -ENOMEM;

diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 940fa1e..21cd4c7 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -5545,7 +5545,7 @@ int sym_hcb_attach(struct Scsi_Host *sho
 	/*
 	 *  Allocate the array of lists of CCBs hashed by DSA.
 	 */
-	np->ccbh = kcalloc(sizeof(struct sym_ccb **), CCB_HASH_SIZE, GFP_KERNEL);
+	np->ccbh = kcalloc(CCB_HASH_SIZE, sizeof(struct sym_ccb **), GFP_KERNEL);
 	if (!np->ccbh)
 		goto attach_failed;

diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 7e8a0ac..0df16f9 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -705,7 +705,7 @@ static int uss720_probe(struct usb_inter
 	/*
 	 * Allocate parport interface
 	 */
-	if (!(priv = kcalloc(sizeof(struct parport_uss720_private), 1, GFP_KERNEL))) {
+	if (!(priv = kcalloc(1, sizeof(struct parport_uss720_private), GFP_KERNEL))) {
 		usb_put_dev(usbdev);
 		return -ENOMEM;
 	}
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index eb44ec9..1ae79a8 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -308,7 +308,7 @@ __svc_create(struct svc_program *prog, u

 	serv->sv_nrpools = npools;
 	serv->sv_pools =
-		kcalloc(sizeof(struct svc_pool), serv->sv_nrpools,
+		kcalloc(serv->sv_nrpools, sizeof(struct svc_pool),
 			GFP_KERNEL);
 	if (!serv->sv_pools) {
 		kfree(serv);

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

* Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-08 23:41 [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc() Robert P. J. Day
@ 2006-12-09 13:53 ` Pekka Enberg
  2006-12-09 13:54   ` Pekka Enberg
  2006-12-09 14:00   ` Robert P. J. Day
  0 siblings, 2 replies; 12+ messages in thread
From: Pekka Enberg @ 2006-12-09 13:53 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list

On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> @@ -705,7 +705,7 @@ static int uss720_probe(struct usb_inter
>         /*
>          * Allocate parport interface
>          */
> -       if (!(priv = kcalloc(sizeof(struct parport_uss720_private), 1, GFP_KERNEL))) {
> +       if (!(priv = kcalloc(1, sizeof(struct parport_uss720_private), GFP_KERNEL))) {

This one should be kzalloc

You really ought to send these cleanups to akpm@osdl.org with LKML
cc'd to get them merged.

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

* Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 13:53 ` Pekka Enberg
@ 2006-12-09 13:54   ` Pekka Enberg
  2006-12-09 14:03     ` Robert P. J. Day
  2006-12-09 14:00   ` Robert P. J. Day
  1 sibling, 1 reply; 12+ messages in thread
From: Pekka Enberg @ 2006-12-09 13:54 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list

On 12/9/06, Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> You really ought to send these cleanups to akpm@osdl.org with LKML
> cc'd to get them merged.

...or even better, the relevant maintainer.

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

* Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 13:53 ` Pekka Enberg
  2006-12-09 13:54   ` Pekka Enberg
@ 2006-12-09 14:00   ` Robert P. J. Day
  2006-12-09 14:13     ` Pekka Enberg
  1 sibling, 1 reply; 12+ messages in thread
From: Robert P. J. Day @ 2006-12-09 14:00 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Linux kernel mailing list

On Sat, 9 Dec 2006, Pekka Enberg wrote:

> On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> > @@ -705,7 +705,7 @@ static int uss720_probe(struct usb_inter
> >         /*
> >          * Allocate parport interface
> >          */
> > -       if (!(priv = kcalloc(sizeof(struct parport_uss720_private), 1,
> > GFP_KERNEL))) {
> > +       if (!(priv = kcalloc(1, sizeof(struct parport_uss720_private),
> > GFP_KERNEL))) {
>
> This one should be kzalloc
>
> You really ought to send these cleanups to akpm@osdl.org with LKML
> cc'd to get them merged.

good point, and argh.  good point in that any further patches that are
primarily stylistic and/or aesthetic like the above will be sent to
akpm, and CC'ed to list.

argh, in that i've already mentioned that, following the guidelines in
"SubmittingPatches", i prefer that each of my patches have one logical
purpose.  once the order of the kcalloc() args is corrected, that
would be followed by a single subsequent patch that did the
kcalloc->kzalloc transformation all at once.

if that's *not* the way folks on this list wish to see patches, then
that advice should be removed from "SubmittingPatches."

as captain hollister once said to dave lister, "choose."

rday

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

* Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 13:54   ` Pekka Enberg
@ 2006-12-09 14:03     ` Robert P. J. Day
  2006-12-09 14:18       ` Pekka Enberg
  0 siblings, 1 reply; 12+ messages in thread
From: Robert P. J. Day @ 2006-12-09 14:03 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Linux kernel mailing list

On Sat, 9 Dec 2006, Pekka Enberg wrote:

> On 12/9/06, Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> > You really ought to send these cleanups to akpm@osdl.org with LKML
> > cc'd to get them merged.
>
> ...or even better, the relevant maintainer.

normally what i would do but, in the case of that patch, there are
five files affected, *all* of which are in totally different
subsystems (macintosh, net, scsi, usb, sunrpc).  are you suggesting
that up to 5 different people be CC'ed?

and what about source-wide aesthetic changes that might touch dozens
or hundreds of files?

rday

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

* Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:00   ` Robert P. J. Day
@ 2006-12-09 14:13     ` Pekka Enberg
  2006-12-09 14:17       ` Robert P. J. Day
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka Enberg @ 2006-12-09 14:13 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list

On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> argh, in that i've already mentioned that, following the guidelines in
> "SubmittingPatches", i prefer that each of my patches have one logical
> purpose.  once the order of the kcalloc() args is corrected, that
> would be followed by a single subsequent patch that did the
> kcalloc->kzalloc transformation all at once.

...and what would that buy us? Nothing. It *really* wants to use
kzalloc and the transformation is equivalent, so please make it one
patch.

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

* Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:13     ` Pekka Enberg
@ 2006-12-09 14:17       ` Robert P. J. Day
  2006-12-09 14:31         ` Pekka Enberg
  2006-12-09 21:57         ` Stefan Richter
  0 siblings, 2 replies; 12+ messages in thread
From: Robert P. J. Day @ 2006-12-09 14:17 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Linux kernel mailing list

On Sat, 9 Dec 2006, Pekka Enberg wrote:

> On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> > argh, in that i've already mentioned that, following the guidelines in
> > "SubmittingPatches", i prefer that each of my patches have one logical
> > purpose.  once the order of the kcalloc() args is corrected, that
> > would be followed by a single subsequent patch that did the
> > kcalloc->kzalloc transformation all at once.
>
> ...and what would that buy us? Nothing. It *really* wants to use
> kzalloc and the transformation is equivalent, so please make it one
> patch.

no.  those two submissions represent two logically different "fixes"
and i have no intention of combining them.

rday

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

* Re: Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:03     ` Robert P. J. Day
@ 2006-12-09 14:18       ` Pekka Enberg
  2006-12-09 21:55         ` Stefan Richter
  0 siblings, 1 reply; 12+ messages in thread
From: Pekka Enberg @ 2006-12-09 14:18 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list

On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> normally what i would do but, in the case of that patch, there are
> five files affected, *all* of which are in totally different
> subsystems (macintosh, net, scsi, usb, sunrpc).  are you suggesting
> that up to 5 different people be CC'ed?
>
> and what about source-wide aesthetic changes that might touch dozens
> or hundreds of files?

Well, it depends. There are no fixed rules in the art of patch
feeding. FWIW, I probably would send this patch just to akpm too.

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

* Re: Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:17       ` Robert P. J. Day
@ 2006-12-09 14:31         ` Pekka Enberg
  2006-12-09 14:35           ` Robert P. J. Day
  2006-12-09 21:57         ` Stefan Richter
  1 sibling, 1 reply; 12+ messages in thread
From: Pekka Enberg @ 2006-12-09 14:31 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list

On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> no.  those two submissions represent two logically different "fixes"
> and i have no intention of combining them.

Like I said, fixing the order of kcalloc parameters with a follow-up
patch to use kzalloc is just plain stupid. You can ignore my review
comments all you want, but don't expect that bit to be merged. So, for
the record: NAK for that bit of the patch, it should be converted to
kzalloc instead. Thanks.

                              Pekka

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

* Re: Re: Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:31         ` Pekka Enberg
@ 2006-12-09 14:35           ` Robert P. J. Day
  0 siblings, 0 replies; 12+ messages in thread
From: Robert P. J. Day @ 2006-12-09 14:35 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Linux kernel mailing list

On Sat, 9 Dec 2006, Pekka Enberg wrote:

> On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
> > no.  those two submissions represent two logically different "fixes"
> > and i have no intention of combining them.
>
> Like I said, fixing the order of kcalloc parameters with a follow-up
> patch to use kzalloc is just plain stupid. You can ignore my review
> comments all you want, but don't expect that bit to be merged. So,
> for the record: NAK for that bit of the patch, it should be
> converted to kzalloc instead. Thanks.

all right.  but it will be amusing if the resulting patch is rejected
because it combines two different fixes, won't it?  :-)

rday

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

* Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:18       ` Pekka Enberg
@ 2006-12-09 21:55         ` Stefan Richter
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Richter @ 2006-12-09 21:55 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Robert P. J. Day, Linux kernel mailing list

Pekka Enberg wrote:
> On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
>> normally what i would do but, in the case of that patch, there are
>> five files affected, *all* of which are in totally different
>> subsystems (macintosh, net, scsi, usb, sunrpc).  are you suggesting
>> that up to 5 different people be CC'ed?
>>
>> and what about source-wide aesthetic changes that might touch dozens
>> or hundreds of files?
> 
> Well, it depends. There are no fixed rules in the art of patch
> feeding. FWIW, I probably would send this patch just to akpm too.

Yes, patches like this one are no big deal. But being involved in subsystem
maintenance, I find patches split up per subsystem much easier to handle.
Ccing the subsystem maintainers doen't make much sens if you don't split the
patch for them to integrate separately.
-- 
Stefan Richter
-=====-=-==- ==-- -=--=
http://arcgraph.de/sr/

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

* Re: [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc().
  2006-12-09 14:17       ` Robert P. J. Day
  2006-12-09 14:31         ` Pekka Enberg
@ 2006-12-09 21:57         ` Stefan Richter
  1 sibling, 0 replies; 12+ messages in thread
From: Stefan Richter @ 2006-12-09 21:57 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Pekka Enberg, Linux kernel mailing list

Robert P. J. Day wrote:
> On Sat, 9 Dec 2006, Pekka Enberg wrote:
>> On 12/9/06, Robert P. J. Day <rpjday@mindspring.com> wrote:
>>> once the order of the kcalloc() args is corrected, that
>>> would be followed by a single subsequent patch that did the
>>> kcalloc->kzalloc transformation all at once.
>> ...and what would that buy us? Nothing. It *really* wants to use
>> kzalloc and the transformation is equivalent, so please make it one
>> patch.
> 
> no.  those two submissions represent two logically different "fixes"
> and i have no intention of combining them.

They are both *alloc() related cleanups without change in functionality.
-- 
Stefan Richter
-=====-=-==- ==-- -=--=
http://arcgraph.de/sr/

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

end of thread, other threads:[~2006-12-09 21:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-08 23:41 [PATCH] kcalloc: Re-order the first two out-of-order args to kcalloc() Robert P. J. Day
2006-12-09 13:53 ` Pekka Enberg
2006-12-09 13:54   ` Pekka Enberg
2006-12-09 14:03     ` Robert P. J. Day
2006-12-09 14:18       ` Pekka Enberg
2006-12-09 21:55         ` Stefan Richter
2006-12-09 14:00   ` Robert P. J. Day
2006-12-09 14:13     ` Pekka Enberg
2006-12-09 14:17       ` Robert P. J. Day
2006-12-09 14:31         ` Pekka Enberg
2006-12-09 14:35           ` Robert P. J. Day
2006-12-09 21:57         ` Stefan Richter

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®