Skip to content

Commit

Permalink
ath10k: add missing error return code in ath10k_pci_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit e2783e2 ]

When chip_id is not supported, the resources will be freed
on path err_unsupported, these resources will also be freed
when calling ath10k_pci_remove(), it will cause double free,
so return -ENODEV when it doesn't support the device with wrong
chip_id.

Fixes: c0c378f ("ath10k: remove target soc ps code")
Fixes: 7505f7c ("ath10k: create a chip revision whitelist")
Fixes: f8914a1 ("ath10k: restore QCA9880-AR1A (v1) detection")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210522105822.1091848-3-yangyingliang@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Jul 14, 2021
1 parent a9bd7c6 commit dcf8171
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/net/wireless/ath/ath10k/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3685,8 +3685,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
if (bus_params.chip_id != 0xffffffff) {
if (!ath10k_pci_chip_is_supported(pdev->device,
bus_params.chip_id))
bus_params.chip_id)) {
ret = -ENODEV;
goto err_unsupported;
}
}
}

Expand All @@ -3697,11 +3699,15 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
}

bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
if (bus_params.chip_id == 0xffffffff)
if (bus_params.chip_id == 0xffffffff) {
ret = -ENODEV;
goto err_unsupported;
}

if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id))
if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) {
ret = -ENODEV;
goto err_unsupported;
}

ret = ath10k_core_register(ar, &bus_params);
if (ret) {
Expand Down

0 comments on commit dcf8171

Please sign in to comment.