]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
enic: cleanup vic_provinfo_alloc()
authorDan Carpenter <error27@gmail.com>
Wed, 9 Jun 2010 21:59:03 +0000 (21:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 12 Jun 2010 01:37:07 +0000 (18:37 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/enic/vnic_vic.c

index d769772998c6331e026393279c3d8997347fc8e8..0a35085004d0f6e7716a20d7468e39bf07ca303e 100644 (file)
 
 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));