Skip to content

Commit

Permalink
net: mvpp2: Improve two size determinations in mvpp2_probe()
Browse files Browse the repository at this point in the history
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: Markus Elfring <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
elfring authored and davem330 committed Apr 18, 2017
1 parent 02c91ec commit 0b92e59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/marvell/mvpp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6873,7 +6873,7 @@ static int mvpp2_probe(struct platform_device *pdev)
int port_count, cpu;
int err;

priv = devm_kzalloc(&pdev->dev, sizeof(struct mvpp2), GFP_KERNEL);
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

Expand Down Expand Up @@ -6970,8 +6970,8 @@ static int mvpp2_probe(struct platform_device *pdev)
}

priv->port_list = devm_kcalloc(&pdev->dev, port_count,
sizeof(struct mvpp2_port *),
GFP_KERNEL);
sizeof(*priv->port_list),
GFP_KERNEL);
if (!priv->port_list) {
err = -ENOMEM;
goto err_mg_clk;
Expand Down

0 comments on commit 0b92e59

Please sign in to comment.