Skip to content

Commit

Permalink
PCI: switchtec: Fix an error handling path in switchtec_pci_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit dec529b ]

The commit in Fixes changed the logic on how resources are released and
introduced a new switchtec_exit_pci() that need to be called explicitly in
order to undo a corresponding switchtec_init_pci().

This was done in the remove function, but not in the probe.

Fix the probe now.

Fixes: df25461 ("PCI: switchtec: Fix stdev_release() crash after surprise hot remove")
Link: https://lore.kernel.org/r/01446d2ccb91a578239915812f2b7dfbeb2882af.1703428183.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and Sasha Levin committed Mar 26, 2024
1 parent 0bdb56e commit ce6e3c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/pci/switch/switchtec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
rc = switchtec_init_isr(stdev);
if (rc) {
dev_err(&stdev->dev, "failed to init isr.\n");
goto err_put;
goto err_exit_pci;
}

iowrite32(SWITCHTEC_EVENT_CLEAR |
Expand All @@ -1635,6 +1635,8 @@ static int switchtec_pci_probe(struct pci_dev *pdev,

err_devadd:
stdev_kill(stdev);
err_exit_pci:
switchtec_exit_pci(stdev);
err_put:
ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt));
put_device(&stdev->dev);
Expand Down

0 comments on commit ce6e3c0

Please sign in to comment.