Skip to content

Commit 45f972a

Browse files
minimaxwelldavem330
authored andcommitted
net: mvpp2: Fix clk error path in mvpp2_probe
When clk_prepare_enable fails for the axi_clk, the mg_clk isn't properly cleaned up. Add another jump label to handle that case, and make sure we jump to it in the later error cases. Fixes: 4792ea0 ("net: mvpp2: Fix clock resource by adding an optional bus clock") Signed-off-by: Maxime Chevallier <[email protected]> Acked-by: Gregory CLEMENT <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c55ca68 commit 45f972a

File tree

1 file changed

+8
-7
lines changed
  • drivers/net/ethernet/marvell

1 file changed

+8
-7
lines changed

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8774,12 +8774,12 @@ static int mvpp2_probe(struct platform_device *pdev)
87748774
if (IS_ERR(priv->axi_clk)) {
87758775
err = PTR_ERR(priv->axi_clk);
87768776
if (err == -EPROBE_DEFER)
8777-
goto err_gop_clk;
8777+
goto err_mg_clk;
87788778
priv->axi_clk = NULL;
87798779
} else {
87808780
err = clk_prepare_enable(priv->axi_clk);
87818781
if (err < 0)
8782-
goto err_gop_clk;
8782+
goto err_mg_clk;
87838783
}
87848784

87858785
/* Get system's tclk rate */
@@ -8793,22 +8793,22 @@ static int mvpp2_probe(struct platform_device *pdev)
87938793
if (priv->hw_version == MVPP22) {
87948794
err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK);
87958795
if (err)
8796-
goto err_mg_clk;
8796+
goto err_axi_clk;
87978797
/* Sadly, the BM pools all share the same register to
87988798
* store the high 32 bits of their address. So they
87998799
* must all have the same high 32 bits, which forces
88008800
* us to restrict coherent memory to DMA_BIT_MASK(32).
88018801
*/
88028802
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
88038803
if (err)
8804-
goto err_mg_clk;
8804+
goto err_axi_clk;
88058805
}
88068806

88078807
/* Initialize network controller */
88088808
err = mvpp2_init(pdev, priv);
88098809
if (err < 0) {
88108810
dev_err(&pdev->dev, "failed to initialize controller\n");
8811-
goto err_mg_clk;
8811+
goto err_axi_clk;
88128812
}
88138813

88148814
/* Initialize ports */
@@ -8821,7 +8821,7 @@ static int mvpp2_probe(struct platform_device *pdev)
88218821
if (priv->port_count == 0) {
88228822
dev_err(&pdev->dev, "no ports enabled\n");
88238823
err = -ENODEV;
8824-
goto err_mg_clk;
8824+
goto err_axi_clk;
88258825
}
88268826

88278827
/* Statistics must be gathered regularly because some of them (like
@@ -8849,8 +8849,9 @@ static int mvpp2_probe(struct platform_device *pdev)
88498849
mvpp2_port_remove(priv->port_list[i]);
88508850
i++;
88518851
}
8852-
err_mg_clk:
8852+
err_axi_clk:
88538853
clk_disable_unprepare(priv->axi_clk);
8854+
err_mg_clk:
88548855
if (priv->hw_version == MVPP22)
88558856
clk_disable_unprepare(priv->mg_clk);
88568857
err_gop_clk:

0 commit comments

Comments
 (0)