[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210527144240.56365-1-krzysztof.kozlowski@canonical.com>
Date: Thu, 27 May 2021 10:42:39 -0400
From: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Liu Shuo <b35362@...escale.com>,
Prabhakar Kushwaha <prabhakar@...escale.com>,
Li Yang <leoyang.li@....com>,
Dipen Dudhat <Dipen.Dudhat@...escale.com>,
linux-kernel@...r.kernel.org, Raghav Dogra <raghav.dogra@....com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
kernel test robot <lkp@...el.com>
Subject: [RFT PATCH 1/2] memory: fsl_ifc: fix leaking IO mapping on probe failure
On probe error the driver should unmap the IO memory. Smatch reports:
drivers/memory/fsl_ifc.c:298 fsl_ifc_ctrl_probe() warn: 'fsl_ifc_ctrl_dev->gregs' not released on lines: 298.
Fixes: a20cbdeffce2 ("powerpc/fsl: Add support for Integrated Flash Controller")
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
---
Only build tested.
---
drivers/memory/fsl_ifc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
index 89f99b5b6450..a6324044a085 100644
--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -219,8 +219,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
fsl_ifc_ctrl_dev->gregs = of_iomap(dev->dev.of_node, 0);
if (!fsl_ifc_ctrl_dev->gregs) {
dev_err(&dev->dev, "failed to get memory region\n");
- ret = -ENODEV;
- goto err;
+ return -ENODEV;
}
if (of_property_read_bool(dev->dev.of_node, "little-endian")) {
@@ -295,6 +294,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
irq_dispose_mapping(fsl_ifc_ctrl_dev->irq);
err:
+ iounmap(fsl_ifc_ctrl_dev->gregs);
return ret;
}
--
2.27.0
Powered by blists - more mailing lists