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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZvVbogBA_mlelt8H@kuha.fi.intel.com>
Date: Thu, 26 Sep 2024 16:03:30 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: R Sundar <prosunofficial@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	RD Babiera <rdbabiera@...gle.com>,
	Guenter Roeck <linux@...ck-us.net>,
	Badhri Jagan Sridharan <badhri@...gle.com>,
	Kyle Tso <kyletso@...gle.com>, Xu Yang <xu.yang_2@....com>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	frank.wang@...k-chips.com, kernel test robot <lkp@...el.com>,
	Julia Lawall <julia.lawall@...ia.fr>
Subject: Re: [PATCH linux-next] usb: typec: tcpm: use max() to get higher
 value

On Wed, Sep 25, 2024 at 05:50:14PM +0530, R Sundar wrote:
> Use max() for better readability and to fix cocci warnings.
> 
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Julia Lawall <julia.lawall@...ia.fr>
> Closes: https://lore.kernel.org/r/202409231009.2efXAh9b-lkp@intel.com/
> Signed-off-by: R Sundar <prosunofficial@...il.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
> 
> Reported in linux repo.
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> 
> cocci warnings: (new ones prefixed by >>)
> >> drivers/usb/typec/tcpm/tcpm.c:6356:20-21: WARNING opportunity for max()
> 
> vim +6356 drivers/usb/typec/tcpm/tcpm.c
> 
> compile-tested only.
> 
>  drivers/usb/typec/tcpm/tcpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index fc619478200f..aac4de1d53a8 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -7367,7 +7367,7 @@ static int tcpm_psy_get_input_power_limit(struct tcpm_port *port,
>  			src_mv = pdo_fixed_voltage(pdo);
>  			src_ma = pdo_max_current(pdo);
>  			tmp = src_mv * src_ma;
> -			max_src_uw = tmp > max_src_uw ? tmp : max_src_uw;
> +			max_src_uw = max(tmp, max_src_uw);
>  		}
>  	}
>  
> -- 
> 2.34.1

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ