diff mbox

[v2,2/3] dmaengine: imx-sdma: sdma_get_firmware does not need to copy fw_name

Message ID 1310723066-567-3-git-send-email-shawn.guo@linaro.org
State Accepted
Commit 40ad5b37914368a4f2c5ff1e72712375d6f1188b
Headers show

Commit Message

Shawn Guo July 15, 2011, 9:44 a.m. UTC
It does not need to allocate space and copy fw_name in function
sdma_get_firmware().

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/dma/imx-sdma.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

Comments

Uwe Kleine-König Sept. 5, 2011, 9:20 a.m. UTC | #1
On Fri, Jul 15, 2011 at 05:44:25PM +0800, Shawn Guo wrote:
> It does not need to allocate space and copy fw_name in function
> sdma_get_firmware().
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
(appointed to act for Sascha who is on vacation)

Thanks
Uwe

> ---
>  drivers/dma/imx-sdma.c |   12 ++----------
>  1 files changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 4a7aa72..6b839a2 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -1125,22 +1125,14 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma,
>  		const char *fw_name)
>  {
>  	const struct firmware *fw;
> -	char *fwname;
>  	const struct sdma_firmware_header *header;
>  	int ret;
>  	const struct sdma_script_start_addrs *addr;
>  	unsigned short *ram_code;
>  
> -	fwname = kasprintf(GFP_KERNEL, "%s", fw_name);
> -	if (!fwname)
> -		return -ENOMEM;
> -
> -	ret = request_firmware(&fw, fwname, sdma->dev);
> -	if (ret) {
> -		kfree(fwname);
> +	ret = request_firmware(&fw, fw_name, sdma->dev);
> +	if (ret)
>  		return ret;
> -	}
> -	kfree(fwname);
>  
>  	if (fw->size < sizeof(*header))
>  		goto err_firmware;
> -- 
> 1.7.4.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
diff mbox

Patch

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 4a7aa72..6b839a2 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1125,22 +1125,14 @@  static int __init sdma_get_firmware(struct sdma_engine *sdma,
 		const char *fw_name)
 {
 	const struct firmware *fw;
-	char *fwname;
 	const struct sdma_firmware_header *header;
 	int ret;
 	const struct sdma_script_start_addrs *addr;
 	unsigned short *ram_code;
 
-	fwname = kasprintf(GFP_KERNEL, "%s", fw_name);
-	if (!fwname)
-		return -ENOMEM;
-
-	ret = request_firmware(&fw, fwname, sdma->dev);
-	if (ret) {
-		kfree(fwname);
+	ret = request_firmware(&fw, fw_name, sdma->dev);
+	if (ret)
 		return ret;
-	}
-	kfree(fwname);
 
 	if (fw->size < sizeof(*header))
 		goto err_firmware;