linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup
@ 2019-10-28 18:13 Saurav Girepunje
  2019-10-29 11:22 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Saurav Girepunje @ 2019-10-28 18:13 UTC (permalink / raw)
  To: joern, dwmw2, computersforpeace, marek.vasut, miquel.raynal,
	richard, vigneshr, linux-mtd, linux-kernel
  Cc: saurav.girepunje

Remove multiple kfree statement from phram_setup() in phram.c

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/mtd/devices/phram.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index c467286ca007..38f95a1517ac 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -243,22 +243,22 @@ static int phram_setup(const char *val)
 
 	ret = parse_num64(&start, token[1]);
 	if (ret) {
-		kfree(name);
 		parse_err("illegal start address\n");
+		goto free_nam;
 	}
 
 	ret = parse_num64(&len, token[2]);
 	if (ret) {
-		kfree(name);
 		parse_err("illegal device length\n");
+		goto free_nam;
 	}
 
 	ret = register_device(name, start, len);
 	if (!ret)
 		pr_info("%s device: %#llx at %#llx\n", name, len, start);
-	else
-		kfree(name);
 
+free_nam:
+	kfree(name);
 	return ret;
 }
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup
  2019-10-28 18:13 [PATCH] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup Saurav Girepunje
@ 2019-10-29 11:22 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2019-10-29 11:22 UTC (permalink / raw)
  To: Saurav Girepunje
  Cc: vigneshr, richard, joern, linux-kernel, marek.vasut, linux-mtd,
	saurav.girepunje, computersforpeace, dwmw2

Hi Saurav,

Saurav Girepunje <saurav.girepunje@gmail.com> wrote on Mon, 28 Oct 2019
23:43:01 +0530:

> Remove multiple kfree statement from phram_setup() in phram.c
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---

Here you should add a changelog with the changes you have done since
the last version.

Also when formatting the patch use -v <x> to add a version prefix
into the title, like [PATCH v<x>].

>  drivers/mtd/devices/phram.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> index c467286ca007..38f95a1517ac 100644
> --- a/drivers/mtd/devices/phram.c
> +++ b/drivers/mtd/devices/phram.c
> @@ -243,22 +243,22 @@ static int phram_setup(const char *val)
>  
>  	ret = parse_num64(&start, token[1]);
>  	if (ret) {
> -		kfree(name);
>  		parse_err("illegal start address\n");
> +		goto free_nam;

s/nam/name

>  	}
>  
>  	ret = parse_num64(&len, token[2]);
>  	if (ret) {
> -		kfree(name);
>  		parse_err("illegal device length\n");
> +		goto free_nam;
>  	}
>  
>  	ret = register_device(name, start, len);
>  	if (!ret)
>  		pr_info("%s device: %#llx at %#llx\n", name, len, start);
> -	else
> -		kfree(name);
>  
> +free_nam:
> +	kfree(name);
>  	return ret;
>  }
>  

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2019-10-29 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-28 18:13 [PATCH] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup Saurav Girepunje
2019-10-29 11:22 ` Miquel Raynal

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