All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup
@ 2019-10-29 17:08 ` Saurav Girepunje
  0 siblings, 0 replies; 5+ messages in thread
From: Saurav Girepunje @ 2019-10-29 17:08 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>
---

Change in v1:

- Add change suggested by Miquel Raynal <miquel.raynal@bootlin.com>
  "The goto statement should not describe from where it is called but the
   action it is supposed to take. 'goto free_nam;' would be better."

 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


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

* [PATCH v1] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup
@ 2019-10-29 17:08 ` Saurav Girepunje
  0 siblings, 0 replies; 5+ messages in thread
From: Saurav Girepunje @ 2019-10-29 17:08 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>
---

Change in v1:

- Add change suggested by Miquel Raynal <miquel.raynal@bootlin.com>
  "The goto statement should not describe from where it is called but the
   action it is supposed to take. 'goto free_nam;' would be better."

 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] 5+ messages in thread

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

Saurav,

Saurav Girepunje <saurav.girepunje@gmail.com> wrote on Tue, 29 Oct 2019
22:38:49 +0530:

Are you a robot?

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

This does not describe what you are doing, you don't remove them you
factorize them. And honestly I am not convinced this change is useful
in old code.

> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
> 
> Change in v1:

Your first version is v1, how can you be at v1? It is almost v3 already!

> 
> - Add change suggested by Miquel Raynal <miquel.raynal@bootlin.com>
>   "The goto statement should not describe from where it is called but the
>    action it is supposed to take. 'goto free_nam;' would be better."

This is a copy/paste of what I have said. What I want you to write is:

"
- Rename the goto statement to describe bla bla bla.
- Fix the typo in the goto label.
"

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

Come one...


Thanks,
Miquèl

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

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

Saurav,

Saurav Girepunje <saurav.girepunje@gmail.com> wrote on Tue, 29 Oct 2019
22:38:49 +0530:

Are you a robot?

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

This does not describe what you are doing, you don't remove them you
factorize them. And honestly I am not convinced this change is useful
in old code.

> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
> 
> Change in v1:

Your first version is v1, how can you be at v1? It is almost v3 already!

> 
> - Add change suggested by Miquel Raynal <miquel.raynal@bootlin.com>
>   "The goto statement should not describe from where it is called but the
>    action it is supposed to take. 'goto free_nam;' would be better."

This is a copy/paste of what I have said. What I want you to write is:

"
- Rename the goto statement to describe bla bla bla.
- Fix the typo in the goto label.
"

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

Come one...


Thanks,
Miquèl

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

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

* Re: [PATCH v1] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup
       [not found]   ` <CAEZuxTSjS=0CP0+tJOst23pX+-g1cXoDcX1Jemz+8s4NTokKUg@mail.gmail.com>
@ 2019-10-30 13:33     ` Miquel Raynal
  0 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2019-10-30 13:33 UTC (permalink / raw)
  To: Saurav Girepunje, linux-mtd

Hi Saurav,

Saurav Girepunje <saurav.girepunje@gmail.com> wrote on Wed, 30 Oct 2019
16:57:06 +0530:

> Are you a robot?
> No
> 
> Thanks for you input. Will dorp this patch if you are not convinced for
> changes.
> 
> Due to your suggestions only I learned how to add version and change log in
> patch file. However I did mistake in this patch version and change log but
> I learned about it.Before sending this I was totally unaware about these
> things.
> 
> Thanks again for your help....

Ok then please have a look at this, first:
https://elixir.bootlin.com/linux/latest/source/Documentation/process/submitting-patches.rst

And please make sure you address the comments. I told you to fix a
typo, you added it in your changelog but you forgot to actually do the
change. Please do not hurry when you want to submit changes and reread
them before actually sending them.

> 
> On Wed, 30 Oct, 2019, 1:50 PM Miquel Raynal, <miquel.raynal@bootlin.com>
> wrote:
> 
> > Saurav,
> >
> > Saurav Girepunje <saurav.girepunje@gmail.com> wrote on Tue, 29 Oct 2019
> > 22:38:49 +0530:
> >
> > Are you a robot?
> >  
> > > Remove multiple kfree statement from phram_setup() in phram.c  
> >
> > This does not describe what you are doing, you don't remove them you
> > factorize them. And honestly I am not convinced this change is useful
> > in old code.
> >  
> > >
> > > Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> > > ---
> > >
> > > Change in v1:  
> >
> > Your first version is v1, how can you be at v1? It is almost v3 already!
> >  
> > >
> > > - Add change suggested by Miquel Raynal <miquel.raynal@bootlin.com>
> > >   "The goto statement should not describe from where it is called but the
> > >    action it is supposed to take. 'goto free_nam;' would be better."  
> >
> > This is a copy/paste of what I have said. What I want you to write is:
> >
> > "
> > - Rename the goto statement to describe bla bla bla.
> > - Fix the typo in the goto label.
> > "
> >  
> > >
> > >  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;  
> >
> > Come one...
> >
> >
> > Thanks,
> > Miquèl
> >  

Thanks,
Miquèl

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

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

end of thread, other threads:[~2019-10-30 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 17:08 [PATCH v1] mtd: devices: phram.c: Fix multiple kfree statement from phram_setup Saurav Girepunje
2019-10-29 17:08 ` Saurav Girepunje
2019-10-30  8:20 ` Miquel Raynal
2019-10-30  8:20   ` Miquel Raynal
     [not found]   ` <CAEZuxTSjS=0CP0+tJOst23pX+-g1cXoDcX1Jemz+8s4NTokKUg@mail.gmail.com>
2019-10-30 13:33     ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.