dma: imx-sdma: Add error check on sdma_get_firmware
Subsystems (2)
Fabio Estevam
reviewerPATCH 1/1 dma: imx-sdma: Add error check on sdma_get_firmware
Add error check on sdma_get_firmware for the pdata case.
While at it, distinguish the error message between the pdata and dt cases.
--- drivers/dma/imx-sdma.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/dma/imx-sdma.c +6 -2
@@ -1388,7 +1388,11 @@ static int __init sdma_probe(struct platform_device *pdev)sdma_add_scripts (sdma, pdata->script_addrs);if (pdata) { -sdma_get_firmware (sdma, pdata->fw_name); + ret =sdma_get_firmware (sdma, pdata->fw_name); +if (ret) { +dev_err (&pdev->dev,"failed to get firmware from pdata\n" ); + goto err_init; + } }else {/* * Because that device tree does not encode ROM script address,
@@ -1404,7 +1408,7 @@ static int __init sdma_probe(struct platform_device *pdev) ret =sdma_get_firmware (sdma, fw_name);if (ret) { -dev_err (&pdev->dev,"failed to get firmware\n" ); +dev_err (&pdev->dev,"failed to get firmware from DT\n" ); goto err_init; } }
Signature · 1 line
1.7.1
Sascha Hauer
maintainerQuoted 14 lines · Fabio Estevam
Add error check on
sdma_get_firmwarefor the pdata case.While at it, distinguish the error message between the pdata and dt cases.
Signed-off-by Fabio Estevam <[email protected]>--- drivers/dma/imx-sdma.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)drivers/dma/imx-sdma.c +0
-0
drivers/dma/imx-sdma.c static int __init sdma_probe(struct platform_device *pdev) · line 1395
Quoted 9 lines
drivers/dma/imx-sdma.c +5
-1@@ -1388,7 +1388,11 @@ static int __init sdma_probe(struct platform_device *pdev)sdma_add_scripts (sdma, pdata->script_addrs);if (pdata) { -sdma_get_firmware (sdma, pdata->fw_name); + ret =sdma_get_firmware (sdma, pdata->fw_name); +if (ret) { +dev_err (&pdev->dev,"failed to get firmware from pdata\n" ); + goto err_init; + }
No, you shouldn't bail out here. A failure in sdma_get_firmware only means that we don't have the RAM scripts, but we can continue with the ROM scripts and still do useful things in the driver.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Fabio Estevam
reviewerOn Wed, Feb 29, 2012 at 5:38 AM, Sascha Hauer <[email protected]> wrote:
...
Quoted 7 lines
Quoted 7 lines
drivers/dma/imx-sdma.c +0
-0@@ -1388,7 +1388,11 @@ static int __init sdma_probe(struct platform_device *pdev) sdma_add_scripts(sdma, pdata->script_addrs);
Quoted 11 lines
drivers/dma/imx-sdma.c static int __init sdma_probe(struct platform_device *pdev) · line 1395
Quoted 7 lines
drivers/dma/imx-sdma.c +5
-1if (pdata) { - sdma_get_firmware(sdma, pdata->fw_name); + ret = sdma_get_firmware(sdma, pdata->fw_name); + if (ret) { + dev_err(&pdev->dev, "failed to get firmware from pdata\n"); + goto err_init; + }No, you shouldn't bail out here. A failure in
sdma_get_firmwareonly means that we don't have the RAM scripts, but we can continue with the ROM scripts and still do useful things in the driver.
Ok, the dt case also does a "goto err_init" and I just followed it on the pdata case.
So I plan to do the following:
1. Send a patch for removing the "goto err_init" from the sdma_get_firmware error check in the dt case
2. Send a patch that adds the error check for the pdata case.
Regards,
Fabio Estevam