From: Dan Carpenter Date: Wed, 9 Jun 2010 21:59:03 +0000 (+0000) Subject: enic: cleanup vic_provinfo_alloc() X-Git-Tag: Ubuntu-5.10.0-12.13~27800^2~606 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=fc0ba8e87189b02683177116932fa580ab97b7ff;p=mirror_ubuntu-hirsute-kernel.git enic: cleanup vic_provinfo_alloc() 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c index d769772998c6..0a35085004d0 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));