diff options
Diffstat (limited to 'sound/soc/amd/acp/acp-pci.c')
-rw-r--r-- | sound/soc/amd/acp/acp-pci.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index 2c8e960cc9a6..a0c84cd07fde 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -62,10 +62,9 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id if (!chip) return -ENOMEM; - if (pci_enable_device(pci)) { - dev_err(&pci->dev, "pci_enable_device failed\n"); - return -ENODEV; - } + if (pci_enable_device(pci)) + return dev_err_probe(&pci->dev, -ENODEV, + "pci_enable_device failed\n"); ret = pci_request_regions(pci, "AMD ACP3x audio"); if (ret < 0) { @@ -105,14 +104,13 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id chip->base = devm_ioremap(&pci->dev, addr, pci_resource_len(pci, 0)); if (!chip->base) { ret = -ENOMEM; - goto release_regions; + goto unregister_dmic_dev; } - res = devm_kzalloc(&pci->dev, sizeof(struct resource) * num_res, GFP_KERNEL); + res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL); if (!res) { - platform_device_unregister(dmic_dev); ret = -ENOMEM; - goto release_regions; + goto unregister_dmic_dev; } for (i = 0; i < num_res; i++, res_acp++) { @@ -139,13 +137,14 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id pdev = platform_device_register_full(&pdevinfo); if (IS_ERR(pdev)) { dev_err(&pci->dev, "cannot register %s device\n", pdevinfo.name); - platform_device_unregister(dmic_dev); ret = PTR_ERR(pdev); - goto release_regions; + goto unregister_dmic_dev; } return ret; +unregister_dmic_dev: + platform_device_unregister(dmic_dev); release_regions: pci_release_regions(pci); disable_pci: |