Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d6312ed authored by Markus Elfring's avatar Markus Elfring Committed by David S. Miller
Browse files

net: mvneta: Improve two size determinations in mvneta_init()



Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 29110630
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -4002,8 +4002,7 @@ static int mvneta_init(struct device *dev, struct mvneta_port *pp)
	/* Set port default values */
	/* Set port default values */
	mvneta_defaults_set(pp);
	mvneta_defaults_set(pp);


	pp->txqs = devm_kcalloc(dev, txq_number, sizeof(struct mvneta_tx_queue),
	pp->txqs = devm_kcalloc(dev, txq_number, sizeof(*pp->txqs), GFP_KERNEL);
				GFP_KERNEL);
	if (!pp->txqs)
	if (!pp->txqs)
		return -ENOMEM;
		return -ENOMEM;


@@ -4015,8 +4014,7 @@ static int mvneta_init(struct device *dev, struct mvneta_port *pp)
		txq->done_pkts_coal = MVNETA_TXDONE_COAL_PKTS;
		txq->done_pkts_coal = MVNETA_TXDONE_COAL_PKTS;
	}
	}


	pp->rxqs = devm_kcalloc(dev, rxq_number, sizeof(struct mvneta_rx_queue),
	pp->rxqs = devm_kcalloc(dev, rxq_number, sizeof(*pp->rxqs), GFP_KERNEL);
				GFP_KERNEL);
	if (!pp->rxqs)
	if (!pp->rxqs)
		return -ENOMEM;
		return -ENOMEM;