Commit 74007ae6 authored by Christophe Jaillet's avatar Christophe Jaillet Committed by Guenter Roeck

hwmon: (xgene) Fix up error handling path mixup in 'xgene_hwmon_probe()'

Commit 2ca492e2 has moved the call to 'kfifo_alloc()' from after the
main 'if' statement to before it.
But it has not updated the error handling paths accordingly.

Fix all that:
   - if 'kfifo_alloc()' fails we can return directly
   - direct returns after 'kfifo_alloc()' must now go to 'out_mbox_free'
   - 'goto out_mbox_free' must be replaced by 'goto out', otherwise the
     '[pcc_]mbox_free_channel()' call will be missed.

Fixes: 2ca492e2 ("hwmon: (xgene) Fix crash when alarm occurs before driver probe")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 2bd6bf03
...@@ -630,7 +630,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev) ...@@ -630,7 +630,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
sizeof(struct slimpro_resp_msg) * ASYNC_MSG_FIFO_SIZE, sizeof(struct slimpro_resp_msg) * ASYNC_MSG_FIFO_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (rc) if (rc)
goto out_mbox_free; return -ENOMEM;
INIT_WORK(&ctx->workq, xgene_hwmon_evt_work); INIT_WORK(&ctx->workq, xgene_hwmon_evt_work);
...@@ -646,7 +646,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) ...@@ -646,7 +646,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
if (IS_ERR(ctx->mbox_chan)) { if (IS_ERR(ctx->mbox_chan)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"SLIMpro mailbox channel request failed\n"); "SLIMpro mailbox channel request failed\n");
return -ENODEV; rc = -ENODEV;
goto out_mbox_free;
} }
} else { } else {
struct acpi_pcct_hw_reduced *cppc_ss; struct acpi_pcct_hw_reduced *cppc_ss;
...@@ -654,7 +655,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) ...@@ -654,7 +655,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
if (device_property_read_u32(&pdev->dev, "pcc-channel", if (device_property_read_u32(&pdev->dev, "pcc-channel",
&ctx->mbox_idx)) { &ctx->mbox_idx)) {
dev_err(&pdev->dev, "no pcc-channel property\n"); dev_err(&pdev->dev, "no pcc-channel property\n");
return -ENODEV; rc = -ENODEV;
goto out_mbox_free;
} }
cl->rx_callback = xgene_hwmon_pcc_rx_cb; cl->rx_callback = xgene_hwmon_pcc_rx_cb;
...@@ -662,7 +664,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) ...@@ -662,7 +664,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
if (IS_ERR(ctx->mbox_chan)) { if (IS_ERR(ctx->mbox_chan)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"PPC channel request failed\n"); "PPC channel request failed\n");
return -ENODEV; rc = -ENODEV;
goto out_mbox_free;
} }
/* /*
...@@ -675,13 +678,13 @@ static int xgene_hwmon_probe(struct platform_device *pdev) ...@@ -675,13 +678,13 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
if (!cppc_ss) { if (!cppc_ss) {
dev_err(&pdev->dev, "PPC subspace not found\n"); dev_err(&pdev->dev, "PPC subspace not found\n");
rc = -ENODEV; rc = -ENODEV;
goto out_mbox_free; goto out;
} }
if (!ctx->mbox_chan->mbox->txdone_irq) { if (!ctx->mbox_chan->mbox->txdone_irq) {
dev_err(&pdev->dev, "PCC IRQ not supported\n"); dev_err(&pdev->dev, "PCC IRQ not supported\n");
rc = -ENODEV; rc = -ENODEV;
goto out_mbox_free; goto out;
} }
/* /*
...@@ -696,14 +699,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev) ...@@ -696,14 +699,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
} else { } else {
dev_err(&pdev->dev, "Failed to get PCC comm region\n"); dev_err(&pdev->dev, "Failed to get PCC comm region\n");
rc = -ENODEV; rc = -ENODEV;
goto out_mbox_free; goto out;
} }
if (!ctx->pcc_comm_addr) { if (!ctx->pcc_comm_addr) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Failed to ioremap PCC comm region\n"); "Failed to ioremap PCC comm region\n");
rc = -ENOMEM; rc = -ENOMEM;
goto out_mbox_free; goto out;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment