All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] enic: cleanup vic_provinfo_alloc()
@ 2010-06-10  7:59 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2010-06-10  7:59 UTC (permalink / raw)
  To: Scott Feldman; +Cc: Vasanthy Kolluri, Roopa Prabhu, netdev, kernel-janitors

If oui were a null variable then vic_provinfo_alloc() would leak memory.
But this function is only called from one place and oui is not null so 
I removed the check.

I also moved the memory allocation down a line so it was easier to spot.
(No one ever reads variable declarations).

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c
index d769772..0a35085 100644
--- a/drivers/net/enic/vnic_vic.c
+++ b/drivers/net/enic/vnic_vic.c
@@ -25,9 +25,10 @@
 
 struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type)
 {
-	struct vic_provinfo *vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags);
+	struct vic_provinfo *vp;
 
-	if (!vp || !oui)
+	vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags);
+	if (!vp)
 		return NULL;
 
 	memcpy(vp->oui, oui, sizeof(vp->oui));

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

end of thread, other threads:[~2010-06-12  1:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-10  7:59 [patch] enic: cleanup vic_provinfo_alloc() Dan Carpenter
2010-06-10  7:59 ` Dan Carpenter
2010-06-10  9:22 ` walter harms
2010-06-10  9:22   ` walter harms
2010-06-10  9:32   ` Dan Carpenter
2010-06-10  9:32     ` Dan Carpenter
2010-06-12  0:05 ` Scott Feldman
2010-06-12  0:05   ` Scott Feldman
2010-06-12  1:37 ` David Miller
2010-06-12  1:37   ` David Miller

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.