switch_vlan_config *c;
int j, u, p, s;
- c = kmalloc(sizeof(switch_vlan_config), GFP_KERNEL);
+ c = kzalloc(sizeof(switch_vlan_config), GFP_KERNEL);
if (!c)
return NULL;
- memset(c, 0, sizeof(switch_vlan_config));
while (isspace(*buf)) buf++;
j = 0;
while (isspace(*buf)) buf++;
}
- if (*buf != 0) return NULL;
+ if (*buf != 0) {
+ kfree(c);
+ return NULL;
+ }
c->port &= (1 << driver->ports) - 1;
c->untag &= (1 << driver->ports) - 1;
robo_write32(ROBO_ARLIO_PAGE, 0x63 + regoff, (c->untag << 9) | c->port);
robo_write16(ROBO_ARLIO_PAGE, 0x61 + regoff, nr);
robo_write16(ROBO_ARLIO_PAGE, 0x60 + regoff, 1 << 7);
+ kfree(c);
return 0;
}
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16);
}
+ kfree(c);
return 0;
}
static int handle_reset(void *driver, char *buf, int nr)
{
switch_driver *d = (switch_driver *) driver;
- switch_vlan_config *c = switch_parse_vlan(d, buf);
int j;
__u16 val16;
- if (c == NULL)
- return -EINVAL;
-
/* disable switching */
set_switch(0);