LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Vishal Aslot <os.vaslot@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH] PCI: ibmphp: Fix double unmap of io_mem
Date: Thu, 2 Sep 2021 12:05:52 -0500 [thread overview]
Message-ID: <20210902170552.GA345124@bjorn-Precision-5520> (raw)
In-Reply-To: <20210818165751.591185-1-os.vaslot@gmail.com>
[+cc Lukas, author of the TODO you refer to]
On Wed, Aug 18, 2021 at 11:57:51AM -0500, Vishal Aslot wrote:
> ebda_rsrc_controller() calls iounmap(io_mem) on the error path. It's
> caller, ibmphp_access_ebda() also calls iounmap(io_mem) on good and
> error paths. Removing the iounmap(io_mem) invocation inside
> ebda_rsrc_controller().
>
> Signed-off-by: Vishal Aslot <os.vaslot@gmail.com>
Applied to pci/hotplug for v5.15, thanks!
I also removed the item from the TODO list, so the patch looks like
this:
commit faa2e05ad0dc ("PCI: ibmphp: Fix double unmap of io_mem")
Author: Vishal Aslot <os.vaslot@gmail.com>
Date: Wed Aug 18 11:57:51 2021 -0500
PCI: ibmphp: Fix double unmap of io_mem
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>
diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO
index a32070be5adf..cc6194aa24c1 100644
--- a/drivers/pci/hotplug/TODO
+++ b/drivers/pci/hotplug/TODO
@@ -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
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index 11a2661dc062..7fb75401ad8a 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -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;
@@ -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;
}
> ---
>
> Why am I fixing this?
> I found this clean up item in drivers/pci/hotplug/TODO [lines 43-44]
> and decided to fix it. This is my 2nd patch ever in linux so my
> apologies for any style issues. I am very teachable. :)
>
> drivers/pci/hotplug/ibmphp_ebda.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
> index 11a2661dc062..7fb75401ad8a 100644
> --- a/drivers/pci/hotplug/ibmphp_ebda.c
> +++ b/drivers/pci/hotplug/ibmphp_ebda.c
> @@ -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;
> @@ -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;
> }
>
> --
> 2.27.0
>
prev parent reply other threads:[~2021-09-02 17:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 16:57 Vishal Aslot
2021-09-02 17:05 ` Bjorn Helgaas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210902170552.GA345124@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=os.vaslot@gmail.com \
--subject='Re: [PATCH] PCI: ibmphp: Fix double unmap of io_mem' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).