Commit 9c8774e6 authored by Haowen Bai's avatar Haowen Bai Committed by Paolo Abeni
Browse files

net: eql: Use kzalloc instead of kmalloc/memset



Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.

Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650277333-31090-1-git-send-email-baihaowen@meizu.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 4facbe3d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -425,14 +425,13 @@ static int eql_enslave(struct net_device *master_dev, slaving_request_t __user *
	if ((master_dev->flags & IFF_UP) == IFF_UP) {
		/* slave is not a master & not already a slave: */
		if (!eql_is_master(slave_dev) && !eql_is_slave(slave_dev)) {
			slave_t *s = kmalloc(sizeof(*s), GFP_KERNEL);
			slave_t *s = kzalloc(sizeof(*s), GFP_KERNEL);
			equalizer_t *eql = netdev_priv(master_dev);
			int ret;

			if (!s)
				return -ENOMEM;

			memset(s, 0, sizeof(*s));
			s->dev = slave_dev;
			s->priority = srq.priority;
			s->priority_bps = srq.priority;