diff mbox series

[v2,-next] mtd: rawnand: denali: Fix missing pci_release_regions in probe and remove

Message ID 20240826024339.476921-1-chenridong@huawei.com
State Accepted
Headers show
Series [v2,-next] mtd: rawnand: denali: Fix missing pci_release_regions in probe and remove | expand

Commit Message

chenridong Aug. 26, 2024, 2:43 a.m. UTC
The pci_release_regions was miss at error case, just add it.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
 drivers/mtd/nand/raw/denali_pci.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Miquel Raynal Aug. 26, 2024, 8:11 a.m. UTC | #1
Hi Chen,

chenridong@huawei.com wrote on Mon, 26 Aug 2024 02:43:39 +0000:

> The pci_release_regions was miss at error case, just add it.
> 
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---

Next time please add a changelog here, below the ---.

No need to resend for this time.

>  drivers/mtd/nand/raw/denali_pci.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Thanks,
Miquèl
Chen Ridong Aug. 26, 2024, 8:45 a.m. UTC | #2
On 2024/8/26 16:11, Miquel Raynal wrote:
> Hi Chen,
> 
> chenridong@huawei.com wrote on Mon, 26 Aug 2024 02:43:39 +0000:
> 
>> The pci_release_regions was miss at error case, just add it.
>>
>> Signed-off-by: Chen Ridong <chenridong@huawei.com>
>> ---
> 
> Next time please add a changelog here, below the ---.
> 
> No need to resend for this time.
> 
>>   drivers/mtd/nand/raw/denali_pci.c | 11 ++++++++---
>>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> Thanks,
> Miquèl

Apologies for the missing change log.

Thank you for your reminder.

Best regards,
Ridong
Miquel Raynal Sept. 6, 2024, 3:04 p.m. UTC | #3
On Mon, 2024-08-26 at 02:43:39 UTC, Chen Ridong wrote:
> The pci_release_regions was miss at error case, just add it.
> 
> Signed-off-by: Chen Ridong <chenridong@huawei.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/denali_pci.c b/drivers/mtd/nand/raw/denali_pci.c
index de7e722d3826..e22094e39546 100644
--- a/drivers/mtd/nand/raw/denali_pci.c
+++ b/drivers/mtd/nand/raw/denali_pci.c
@@ -77,18 +77,20 @@  static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	denali->reg = devm_ioremap(denali->dev, csr_base, csr_len);
 	if (!denali->reg) {
 		dev_err(&dev->dev, "Spectra: Unable to remap memory region\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto regions_release;
 	}
 
 	denali->host = devm_ioremap(denali->dev, mem_base, mem_len);
 	if (!denali->host) {
 		dev_err(&dev->dev, "Spectra: ioremap failed!");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto regions_release;
 	}
 
 	ret = denali_init(denali);
 	if (ret)
-		return ret;
+		goto regions_release;
 
 	nsels = denali->nbanks;
 
@@ -116,6 +118,8 @@  static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 out_remove_denali:
 	denali_remove(denali);
+regions_release:
+	pci_release_regions(dev);
 	return ret;
 }
 
@@ -123,6 +127,7 @@  static void denali_pci_remove(struct pci_dev *dev)
 {
 	struct denali_controller *denali = pci_get_drvdata(dev);
 
+	pci_release_regions(dev);
 	denali_remove(denali);
 }