提交 1effa4b5 编写于 作者: Y Yang Yingliang 提交者: Zheng Zengkai

spi: fsl: add missing iounmap() on error in of_fsl_spi_probe()

stable inclusion
from stable-5.10.37
commit 078362f495a0c5477f52fe2dff404fd5aa3dd9e1
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 5fed9fe5 ]

Add the missing iounmap() before return from of_fsl_spi_probe()
in the error handling case.

Fixes: 0f0581b2 ("spi: fsl: Convert to use CS GPIO descriptors")
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210401140350.1677925-1-yangyingliang@huawei.comSigned-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e84cb147
...@@ -707,6 +707,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ...@@ -707,6 +707,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
struct resource mem; struct resource mem;
int irq, type; int irq, type;
int ret; int ret;
bool spisel_boot = false;
#if IS_ENABLED(CONFIG_FSL_SOC)
struct mpc8xxx_spi_probe_info *pinfo = NULL;
#endif
ret = of_mpc8xxx_spi_probe(ofdev); ret = of_mpc8xxx_spi_probe(ofdev);
if (ret) if (ret)
...@@ -715,9 +720,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ...@@ -715,9 +720,8 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
type = fsl_spi_get_type(&ofdev->dev); type = fsl_spi_get_type(&ofdev->dev);
if (type == TYPE_FSL) { if (type == TYPE_FSL) {
struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
bool spisel_boot = false;
#if IS_ENABLED(CONFIG_FSL_SOC) #if IS_ENABLED(CONFIG_FSL_SOC)
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); pinfo = to_of_pinfo(pdata);
spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); spisel_boot = of_property_read_bool(np, "fsl,spisel_boot");
if (spisel_boot) { if (spisel_boot) {
...@@ -746,15 +750,24 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) ...@@ -746,15 +750,24 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
ret = of_address_to_resource(np, 0, &mem); ret = of_address_to_resource(np, 0, &mem);
if (ret) if (ret)
return ret; goto unmap_out;
irq = platform_get_irq(ofdev, 0); irq = platform_get_irq(ofdev, 0);
if (irq < 0) if (irq < 0) {
return irq; ret = irq;
goto unmap_out;
}
master = fsl_spi_probe(dev, &mem, irq); master = fsl_spi_probe(dev, &mem, irq);
return PTR_ERR_OR_ZERO(master); return PTR_ERR_OR_ZERO(master);
unmap_out:
#if IS_ENABLED(CONFIG_FSL_SOC)
if (spisel_boot)
iounmap(pinfo->immr_spi_cs);
#endif
return ret;
} }
static int of_fsl_spi_remove(struct platform_device *ofdev) static int of_fsl_spi_remove(struct platform_device *ofdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册