Skip to content

Commit

Permalink
PCI: ibmphp: Fix double unmap of io_mem
Browse files Browse the repository at this point in the history
[ Upstream commit faa2e05 ]

ebda_rsrc_controller() calls iounmap(io_mem) on the error path. Its caller,
ibmphp_access_ebda(), also calls iounmap(io_mem) on good and error paths.

Remove the iounmap(io_mem) invocation from ebda_rsrc_controller().

[bhelgaas: remove item from TODO]
Link: https://lore.kernel.org/r/20210818165751.591185-1-os.vaslot@gmail.com
Signed-off-by: Vishal Aslot <os.vaslot@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
vaslot-os authored and gregkh committed Sep 22, 2021
1 parent 88013a0 commit b143818
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
3 changes: 0 additions & 3 deletions drivers/pci/hotplug/TODO
Expand Up @@ -40,9 +40,6 @@ ibmphp:

* The return value of pci_hp_register() is not checked.

* iounmap(io_mem) is called in the error path of ebda_rsrc_controller()
and once more in the error path of its caller ibmphp_access_ebda().

* The various slot data structures are difficult to follow and need to be
simplified. A lot of functions are too large and too complex, they need
to be broken up into smaller, manageable pieces. Negative examples are
Expand Down
5 changes: 1 addition & 4 deletions drivers/pci/hotplug/ibmphp_ebda.c
Expand Up @@ -714,8 +714,7 @@ static int __init ebda_rsrc_controller(void)
/* init hpc structure */
hpc_ptr = alloc_ebda_hpc(slot_num, bus_num);
if (!hpc_ptr) {
rc = -ENOMEM;
goto error_no_hpc;
return -ENOMEM;
}
hpc_ptr->ctlr_id = ctlr_id;
hpc_ptr->ctlr_relative_id = ctlr;
Expand Down Expand Up @@ -910,8 +909,6 @@ static int __init ebda_rsrc_controller(void)
kfree(tmp_slot);
error_no_slot:
free_ebda_hpc(hpc_ptr);
error_no_hpc:
iounmap(io_mem);
return rc;
}

Expand Down

0 comments on commit b143818

Please sign in to comment.