]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: hv: Fix the PCI HyperV probe failure path to release resource properly
authorWei Hu <weh@microsoft.com>
Thu, 7 May 2020 05:02:11 +0000 (13:02 +0800)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Mon, 11 May 2020 11:04:35 +0000 (12:04 +0100)
commit78ebd4ee566f5375a4442957615eb0d8b020bb93
treed67c45ae6b96a1fc9b2837c888d5cb30d1622465
parent9b8057e7f937f20763a90a8fc2333168af101732
PCI: hv: Fix the PCI HyperV probe failure path to release resource properly

In some error cases in hv_pci_probe(), allocated resources are not freed.

Fix this by adding a field to keep track of the high water mark for slots
that have resources allocated to them.  In case of an error, this high
water mark is used to know which slots have resources that must be released.
Since slots are numbered starting with zero, a value of -1 indicates no
slots have been allocated resources.  There may be unused slots in the range
between slot 0 and the high water mark slot, but these slots are already
ignored by the existing code in the allocate and release loops with the call
to get_pcichild_wslot().

Link: https://lore.kernel.org/r/20200507050211.10923-1-weh@microsoft.com
Signed-off-by: Wei Hu <weh@microsoft.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
drivers/pci/controller/pci-hyperv.c