Skip to content

Commit

Permalink
enic: cleanup vic_provinfo_alloc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Jun 12, 2010
1 parent 62522d3 commit fc0ba8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/enic/vnic_vic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit fc0ba8e

Please sign in to comment.