linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: imx-sdma: Add error check on sdma_get_firmware
@ 2012-02-20 16:49 Fabio Estevam
  2012-02-29  8:38 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2012-02-20 16:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel, shawn.guo, vinod.koul, dan.j.williams, Fabio Estevam,
	Fabio Estevam

Add error check on sdma_get_firmware for the pdata case.

While at it, distinguish the error message between the pdata and dt cases.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/dma/imx-sdma.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index bf736ad..52a4e6a 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -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;
 		}
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: imx-sdma: Add error check on sdma_get_firmware
  2012-02-20 16:49 [PATCH] dma: imx-sdma: Add error check on sdma_get_firmware Fabio Estevam
@ 2012-02-29  8:38 ` Sascha Hauer
  2012-02-29 13:37   ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2012-02-29  8:38 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: linux-kernel, kernel, shawn.guo, vinod.koul, dan.j.williams,
	Fabio Estevam

On Mon, Feb 20, 2012 at 02:49:50PM -0200, Fabio Estevam wrote:
> Add error check on sdma_get_firmware for the pdata case.
> 
> While at it, distinguish the error message between the pdata and dt cases.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/dma/imx-sdma.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index bf736ad..52a4e6a 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -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


-- 
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 |

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: imx-sdma: Add error check on sdma_get_firmware
  2012-02-29  8:38 ` Sascha Hauer
@ 2012-02-29 13:37   ` Fabio Estevam
  0 siblings, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2012-02-29 13:37 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: linux-kernel, kernel, shawn.guo, vinod.koul, dan.j.williams,
	Fabio Estevam

On Wed, Feb 29, 2012 at 5:38 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
...
>> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
>> index bf736ad..52a4e6a 100644
>> --- a/drivers/dma/imx-sdma.c
>> +++ b/drivers/dma/imx-sdma.c
>> @@ -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.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-29 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20 16:49 [PATCH] dma: imx-sdma: Add error check on sdma_get_firmware Fabio Estevam
2012-02-29  8:38 ` Sascha Hauer
2012-02-29 13:37   ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).