Commit 8bd8fbd8 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Boris Brezillon

mtd: nand: pxa3xx_nand: write exactly one message on probe failure

For some error paths alloc_nand_resource() emitted an error message, for
others it didn't. Make it consistently print a message including the
error code where it's not constant and drop the hardly helpful
additional message printed by the caller of alloc_nand_resource.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 6ea40a3b
...@@ -1774,8 +1774,11 @@ static int alloc_nand_resource(struct platform_device *pdev) ...@@ -1774,8 +1774,11 @@ static int alloc_nand_resource(struct platform_device *pdev)
int ret, irq, cs; int ret, irq, cs;
pdata = dev_get_platdata(&pdev->dev); pdata = dev_get_platdata(&pdev->dev);
if (pdata->num_cs <= 0) if (pdata->num_cs <= 0) {
dev_err(&pdev->dev, "invalid number of chip selects\n");
return -ENODEV; return -ENODEV;
}
info = devm_kzalloc(&pdev->dev, info = devm_kzalloc(&pdev->dev,
sizeof(*info) + sizeof(*host) * pdata->num_cs, sizeof(*info) + sizeof(*host) * pdata->num_cs,
GFP_KERNEL); GFP_KERNEL);
...@@ -1813,8 +1816,9 @@ static int alloc_nand_resource(struct platform_device *pdev) ...@@ -1813,8 +1816,9 @@ static int alloc_nand_resource(struct platform_device *pdev)
nand_hw_control_init(chip->controller); nand_hw_control_init(chip->controller);
info->clk = devm_clk_get(&pdev->dev, NULL); info->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(info->clk)) { if (IS_ERR(info->clk)) {
dev_err(&pdev->dev, "failed to get nand clock\n"); ret = PTR_ERR(info->clk);
return PTR_ERR(info->clk); dev_err(&pdev->dev, "failed to get nand clock: %d\n", ret);
return ret;
} }
ret = clk_prepare_enable(info->clk); ret = clk_prepare_enable(info->clk);
if (ret < 0) if (ret < 0)
...@@ -1842,6 +1846,7 @@ static int alloc_nand_resource(struct platform_device *pdev) ...@@ -1842,6 +1846,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
info->mmio_base = devm_ioremap_resource(&pdev->dev, r); info->mmio_base = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(info->mmio_base)) { if (IS_ERR(info->mmio_base)) {
ret = PTR_ERR(info->mmio_base); ret = PTR_ERR(info->mmio_base);
dev_err(&pdev->dev, "failed to map register space: %d\n", ret);
goto fail_disable_clk; goto fail_disable_clk;
} }
info->mmio_phys = r->start; info->mmio_phys = r->start;
...@@ -1861,7 +1866,7 @@ static int alloc_nand_resource(struct platform_device *pdev) ...@@ -1861,7 +1866,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
pxa3xx_nand_irq_thread, IRQF_ONESHOT, pxa3xx_nand_irq_thread, IRQF_ONESHOT,
pdev->name, info); pdev->name, info);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to request IRQ\n"); dev_err(&pdev->dev, "failed to request IRQ: %d\n", ret);
goto fail_free_buf; goto fail_free_buf;
} }
...@@ -1960,10 +1965,8 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) ...@@ -1960,10 +1965,8 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
} }
ret = alloc_nand_resource(pdev); ret = alloc_nand_resource(pdev);
if (ret) { if (ret)
dev_err(&pdev->dev, "alloc nand resource failed\n");
return ret; return ret;
}
info = platform_get_drvdata(pdev); info = platform_get_drvdata(pdev);
probe_success = 0; probe_success = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment