lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEv2J7Or8zWgoKHy@ryzen>
Date: Fri, 13 Jun 2025 11:57:59 +0200
From: Niklas Cassel <cassel@...nel.org>
To: Hans Zhang <18255117159@....com>
Cc: lpieralisi@...nel.org, kwilczynski@...nel.org, bhelgaas@...gle.com,
	jingoohan1@...il.com, mani@...nel.org, robh@...nel.org,
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs

On Fri, Jun 13, 2025 at 12:12:26AM +0800, Hans Zhang wrote:
> Replace redundant ternary conditional expressions with direct boolean
> returns in PTM visibility functions. Specifically change this pattern:
> 
>     return (condition) ? true : false;
> 
> to the simpler:
> 
>     return condition;
> 
> Signed-off-by: Hans Zhang <18255117159@....com>
> ---
>  .../pci/controller/dwc/pcie-designware-debugfs.c   | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> index c67601096c48..6f438a36f840 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> @@ -814,14 +814,14 @@ static bool dw_pcie_ptm_context_update_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_EP_TYPE;
>  }
>  
>  static bool dw_pcie_ptm_context_valid_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_RC_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_RC_TYPE;
>  }
>  
>  static bool dw_pcie_ptm_local_clock_visible(void *drvdata)
> @@ -834,35 +834,35 @@ static bool dw_pcie_ptm_master_clock_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_EP_TYPE;
>  }
>  
>  static bool dw_pcie_ptm_t1_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_EP_TYPE;
>  }
>  
>  static bool dw_pcie_ptm_t2_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_RC_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_RC_TYPE;
>  }
>  
>  static bool dw_pcie_ptm_t3_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_RC_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_RC_TYPE;
>  }
>  
>  static bool dw_pcie_ptm_t4_visible(void *drvdata)
>  {
>  	struct dw_pcie *pci = drvdata;
>  
> -	return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> +	return pci->mode == DW_PCIE_EP_TYPE;
>  }
>  
>  const struct pcie_ptm_ops dw_pcie_ptm_ops = {
> 
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> -- 
> 2.25.1
> 

Reviewed-by: Niklas Cassel <cassel@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ