linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: devices: phram.c: Fix use true/false for bool type
@ 2019-10-29  3:21 Saurav Girepunje
  2019-10-29  9:14 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 3+ messages in thread
From: Saurav Girepunje @ 2019-10-29  3:21 UTC (permalink / raw)
  To: linux, joern, dwmw2, computersforpeace, marek.vasut,
	miquel.raynal, richard, vigneshr, saurav.girepunje, gregkh, tglx,
	linux-arm-kernel, linux-kernel, linux-mtd
  Cc: saurav.girepunje

Return type for security_extensions_enabled() is bool
so use true/false.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 arch/arm/mm/nommu.c         |  2 +-
 drivers/mtd/devices/phram.c | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 24ecf8d30a1e..1fed74f93c66 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -56,7 +56,7 @@ static inline bool security_extensions_enabled(void)
 	if ((read_cpuid_id() & 0x000f0000) == 0x000f0000)
 		return cpuid_feature_extract(CPUID_EXT_PFR1, 4) ||
 			cpuid_feature_extract(CPUID_EXT_PFR1, 20);
-	return 0;
+	return true;
 }
 
 unsigned long setup_vectors_base(void)
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 86ae13b756b5..931e5c2481b5 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -239,27 +239,26 @@ static int phram_setup(const char *val)
 
 	ret = parse_name(&name, token[0]);
 	if (ret)
-		goto exit;
+		return ret;
 
 	ret = parse_num64(&start, token[1]);
 	if (ret) {
+		kfree(name);
 		parse_err("illegal start address\n");
-		goto parse_err;
 	}
 
 	ret = parse_num64(&len, token[2]);
 	if (ret) {
+		kfree(name);
 		parse_err("illegal device length\n");
-		goto parse_err;
 	}
 
 	ret = register_device(name, start, len);
 	if (!ret)
 		pr_info("%s device: %#llx at %#llx\n", name, len, start);
+	else
+		kfree(name);
 
-parse_err:
-	kfree(name);
-exit:
 	return ret;
 }
 
-- 
2.20.1


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

* Re: [PATCH] mtd: devices: phram.c: Fix use true/false for bool type
  2019-10-29  3:21 [PATCH] mtd: devices: phram.c: Fix use true/false for bool type Saurav Girepunje
@ 2019-10-29  9:14 ` Russell King - ARM Linux admin
  2019-10-29 14:00   ` SAURAV GIREPUNJE
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux admin @ 2019-10-29  9:14 UTC (permalink / raw)
  To: Saurav Girepunje
  Cc: joern, dwmw2, computersforpeace, marek.vasut, miquel.raynal,
	richard, vigneshr, gregkh, tglx, linux-arm-kernel, linux-kernel,
	linux-mtd, saurav.girepunje

On Tue, Oct 29, 2019 at 08:51:42AM +0530, Saurav Girepunje wrote:
> Return type for security_extensions_enabled() is bool
> so use true/false.

This doesn't seem to bear any resemblence to the subject line.

> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  arch/arm/mm/nommu.c         |  2 +-
>  drivers/mtd/devices/phram.c | 11 +++++------
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
> index 24ecf8d30a1e..1fed74f93c66 100644
> --- a/arch/arm/mm/nommu.c
> +++ b/arch/arm/mm/nommu.c
> @@ -56,7 +56,7 @@ static inline bool security_extensions_enabled(void)
>  	if ((read_cpuid_id() & 0x000f0000) == 0x000f0000)
>  		return cpuid_feature_extract(CPUID_EXT_PFR1, 4) ||
>  			cpuid_feature_extract(CPUID_EXT_PFR1, 20);
> -	return 0;
> +	return true;

This isn't explained in the commit.  You explain why it should return
true or false, but you don't explain why converting this from returning
0, aka false, to returning true is necessary.

>  }
>  
>  unsigned long setup_vectors_base(void)
> diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> index 86ae13b756b5..931e5c2481b5 100644
> --- a/drivers/mtd/devices/phram.c
> +++ b/drivers/mtd/devices/phram.c
> @@ -239,27 +239,26 @@ static int phram_setup(const char *val)
>  
>  	ret = parse_name(&name, token[0]);
>  	if (ret)
> -		goto exit;
> +		return ret;
>  
>  	ret = parse_num64(&start, token[1]);
>  	if (ret) {
> +		kfree(name);
>  		parse_err("illegal start address\n");
> -		goto parse_err;
>  	}
>  
>  	ret = parse_num64(&len, token[2]);
>  	if (ret) {
> +		kfree(name);
>  		parse_err("illegal device length\n");
> -		goto parse_err;
>  	}
>  
>  	ret = register_device(name, start, len);
>  	if (!ret)
>  		pr_info("%s device: %#llx at %#llx\n", name, len, start);
> +	else
> +		kfree(name);
>  
> -parse_err:
> -	kfree(name);
> -exit:
>  	return ret;
>  }

At least this partially matches the subject line but it looks unrelated
to the other changes.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH] mtd: devices: phram.c: Fix use true/false for bool type
  2019-10-29  9:14 ` Russell King - ARM Linux admin
@ 2019-10-29 14:00   ` SAURAV GIREPUNJE
  0 siblings, 0 replies; 3+ messages in thread
From: SAURAV GIREPUNJE @ 2019-10-29 14:00 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: joern, dwmw2, computersforpeace, marek.vasut, miquel.raynal,
	richard, vigneshr, gregkh, tglx, linux-arm-kernel, linux-kernel,
	linux-mtd, saurav.girepunje

On Tue, Oct 29, 2019 at 09:14:33AM +0000, Russell King - ARM Linux admin wrote:
> On Tue, Oct 29, 2019 at 08:51:42AM +0530, Saurav Girepunje wrote:
> > Return type for security_extensions_enabled() is bool
> > so use true/false.
> 
> This doesn't seem to bear any resemblence to the subject line.
> 
> > Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> > ---
> >  arch/arm/mm/nommu.c         |  2 +-
> >  drivers/mtd/devices/phram.c | 11 +++++------
> >  2 files changed, 6 insertions(+), 7 deletions(-)
> > 
> > diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
> > index 24ecf8d30a1e..1fed74f93c66 100644
> > --- a/arch/arm/mm/nommu.c
> > +++ b/arch/arm/mm/nommu.c
> > @@ -56,7 +56,7 @@ static inline bool security_extensions_enabled(void)
> >  	if ((read_cpuid_id() & 0x000f0000) == 0x000f0000)
> >  		return cpuid_feature_extract(CPUID_EXT_PFR1, 4) ||
> >  			cpuid_feature_extract(CPUID_EXT_PFR1, 20);
> > -	return 0;
> > +	return true;
> 
> This isn't explained in the commit.  You explain why it should return
> true or false, but you don't explain why converting this from returning
> 0, aka false, to returning true is necessary.
> 
> >  }
> >  
> >  unsigned long setup_vectors_base(void)
> > diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> > index 86ae13b756b5..931e5c2481b5 100644
> > --- a/drivers/mtd/devices/phram.c
> > +++ b/drivers/mtd/devices/phram.c
> > @@ -239,27 +239,26 @@ static int phram_setup(const char *val)
> >  
> >  	ret = parse_name(&name, token[0]);
> >  	if (ret)
> > -		goto exit;
> > +		return ret;
> >  
> >  	ret = parse_num64(&start, token[1]);
> >  	if (ret) {
> > +		kfree(name);
> >  		parse_err("illegal start address\n");
> > -		goto parse_err;
> >  	}
> >  
> >  	ret = parse_num64(&len, token[2]);
> >  	if (ret) {
> > +		kfree(name);
> >  		parse_err("illegal device length\n");
> > -		goto parse_err;
> >  	}
> >  
> >  	ret = register_device(name, start, len);
> >  	if (!ret)
> >  		pr_info("%s device: %#llx at %#llx\n", name, len, start);
> > +	else
> > +		kfree(name);
> >  
> > -parse_err:
> > -	kfree(name);
> > -exit:
> >  	return ret;
> >  }
> 
> At least this partially matches the subject line but it looks unrelated
> to the other changes.
> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
> According to speedtest.net: 11.9Mbps down 500kbps up
Please igonre this patch. Suppose to send for only one file nommu.c. I have seperated and submitted the patch for chnages in file phram.c and nommu.c. Thanks for review ... :-)

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29  3:21 [PATCH] mtd: devices: phram.c: Fix use true/false for bool type Saurav Girepunje
2019-10-29  9:14 ` Russell King - ARM Linux admin
2019-10-29 14:00   ` SAURAV GIREPUNJE

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