]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
rocker: zero allocate ports array
authorScott Feldman <sfeldma@gmail.com>
Mon, 1 Jun 2015 18:39:02 +0000 (11:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jun 2015 00:00:08 +0000 (17:00 -0700)
When allocating the array of rocker port pointers, zero the array values so
we can test for !NULL to see if port is allocated/registered.  We'll need
this later when installing untagged VLAN support for each port, during port
probe.  It's a long story, but to install a VLAN (vid=0 for untagged, in
this case) on a port, we'll need to scan other ports to see if the VLAN
group for that VLAN has been setup.  To scan the other ports, we need to
walk the port array.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.c

index d246647b365304b4f9ae1879c22e6bf6096abd11..b0fb2450912485610ea32da7e57573821645e433 100644 (file)
@@ -4911,7 +4911,7 @@ static int rocker_probe_ports(struct rocker *rocker)
        int err;
 
        alloc_size = sizeof(struct rocker_port *) * rocker->port_count;
-       rocker->ports = kmalloc(alloc_size, GFP_KERNEL);
+       rocker->ports = kzalloc(alloc_size, GFP_KERNEL);
        if (!rocker->ports)
                return -ENOMEM;
        for (i = 0; i < rocker->port_count; i++) {