linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/pci: use true and false for bool variable
@ 2021-03-15  7:40 Yang Li
  2021-03-23 20:38 ` Krzysztof Wilczyński
  2021-05-27 23:54 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Li @ 2021-03-15  7:40 UTC (permalink / raw)
  To: bhelgaas; +Cc: tglx, mingo, bp, x86, hpa, linux-pci, linux-kernel, Yang Li

fixed the following coccicheck:
./arch/x86/pci/mmconfig-shared.c:464:9-10: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool
./arch/x86/pci/mmconfig-shared.c:493:5-6: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool
./arch/x86/pci/mmconfig-shared.c:501:9-10: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool
./arch/x86/pci/mmconfig-shared.c:522:5-6: WARNING: return of 0/1 in
function 'is_mmconf_reserved' with return type bool

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 arch/x86/pci/mmconfig-shared.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index de6bf0e..758cbfe 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -461,7 +461,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
 	}
 
 	if (size < (16UL<<20) && size != old_size)
-		return 0;
+		return false;
 
 	if (dev)
 		dev_info(dev, "MMCONFIG at %pR reserved in %s\n",
@@ -493,7 +493,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
 				&cfg->res, (unsigned long) cfg->address);
 	}
 
-	return 1;
+	return true;
 }
 
 static bool __ref
@@ -501,7 +501,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
 {
 	if (!early && !acpi_disabled) {
 		if (is_mmconf_reserved(is_acpi_reserved, cfg, dev, 0))
-			return 1;
+			return true;
 
 		if (dev)
 			dev_info(dev, FW_INFO
@@ -522,14 +522,14 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
 	 * _CBA method, just assume it's reserved.
 	 */
 	if (pci_mmcfg_running_state)
-		return 1;
+		return true;
 
 	/* Don't try to do this check unless configuration
 	   type 1 is available. how about type 2 ?*/
 	if (raw_pci_ops)
 		return is_mmconf_reserved(e820__mapped_all, cfg, dev, 1);
 
-	return 0;
+	return false;
 }
 
 static void __init pci_mmcfg_reject_broken(int early)
-- 
1.8.3.1


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

* Re: [PATCH] x86/pci: use true and false for bool variable
  2021-03-15  7:40 [PATCH] x86/pci: use true and false for bool variable Yang Li
@ 2021-03-23 20:38 ` Krzysztof Wilczyński
  2021-05-27 23:54 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-03-23 20:38 UTC (permalink / raw)
  To: Yang Li; +Cc: bhelgaas, tglx, mingo, bp, x86, hpa, linux-pci, linux-kernel

Hi,

Thank you for sending the patch over!

> fixed the following coccicheck:
> ./arch/x86/pci/mmconfig-shared.c:464:9-10: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> ./arch/x86/pci/mmconfig-shared.c:493:5-6: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> ./arch/x86/pci/mmconfig-shared.c:501:9-10: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> ./arch/x86/pci/mmconfig-shared.c:522:5-6: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
[...]

Looks good, although a few small nitpicks: you should capitalise the
subject line so that it matches the style used in previous commits, and
the commit message could also be improved in terms of style and also
explaining what and why this patch is fixing the return type (aside of
just addressing report from Cocinelle).

Other than that,

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Thank you!

Krzysztof

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

* Re: [PATCH] x86/pci: use true and false for bool variable
  2021-03-15  7:40 [PATCH] x86/pci: use true and false for bool variable Yang Li
  2021-03-23 20:38 ` Krzysztof Wilczyński
@ 2021-05-27 23:54 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2021-05-27 23:54 UTC (permalink / raw)
  To: Yang Li
  Cc: bhelgaas, tglx, mingo, bp, x86, hpa, linux-pci, linux-kernel,
	Krzysztof Wilczyński

[+cc Krzysztof]

On Mon, Mar 15, 2021 at 03:40:00PM +0800, Yang Li wrote:
> fixed the following coccicheck:
> ./arch/x86/pci/mmconfig-shared.c:464:9-10: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> ./arch/x86/pci/mmconfig-shared.c:493:5-6: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> ./arch/x86/pci/mmconfig-shared.c:501:9-10: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> ./arch/x86/pci/mmconfig-shared.c:522:5-6: WARNING: return of 0/1 in
> function 'is_mmconf_reserved' with return type bool
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Applied to pci/misc for v5.14, thanks!

Did you check all of drivers/pci/ for similar warnings, too?

> ---
>  arch/x86/pci/mmconfig-shared.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
> index de6bf0e..758cbfe 100644
> --- a/arch/x86/pci/mmconfig-shared.c
> +++ b/arch/x86/pci/mmconfig-shared.c
> @@ -461,7 +461,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
>  	}
>  
>  	if (size < (16UL<<20) && size != old_size)
> -		return 0;
> +		return false;
>  
>  	if (dev)
>  		dev_info(dev, "MMCONFIG at %pR reserved in %s\n",
> @@ -493,7 +493,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
>  				&cfg->res, (unsigned long) cfg->address);
>  	}
>  
> -	return 1;
> +	return true;
>  }
>  
>  static bool __ref
> @@ -501,7 +501,7 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
>  {
>  	if (!early && !acpi_disabled) {
>  		if (is_mmconf_reserved(is_acpi_reserved, cfg, dev, 0))
> -			return 1;
> +			return true;
>  
>  		if (dev)
>  			dev_info(dev, FW_INFO
> @@ -522,14 +522,14 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
>  	 * _CBA method, just assume it's reserved.
>  	 */
>  	if (pci_mmcfg_running_state)
> -		return 1;
> +		return true;
>  
>  	/* Don't try to do this check unless configuration
>  	   type 1 is available. how about type 2 ?*/
>  	if (raw_pci_ops)
>  		return is_mmconf_reserved(e820__mapped_all, cfg, dev, 1);
>  
> -	return 0;
> +	return false;
>  }
>  
>  static void __init pci_mmcfg_reject_broken(int early)
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2021-05-27 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15  7:40 [PATCH] x86/pci: use true and false for bool variable Yang Li
2021-03-23 20:38 ` Krzysztof Wilczyński
2021-05-27 23:54 ` Bjorn Helgaas

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