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: <ZJ7PHcDXEJHGBwWc@kuha.fi.intel.com>
Date:   Fri, 30 Jun 2023 15:48:29 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     You Kangren <youkangren@...o.com>
Cc:     Guenter Roeck <linux@...ck-us.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "open list:USB TYPEC PORT CONTROLLER DRIVERS" 
        <linux-usb@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        opensource.kernel@...o.com
Subject: Re: [PATCH] usb: typec: tcpm: Replace the ternary conditional
 operator with max()

On Mon, Jun 26, 2023 at 08:11:05PM +0800, You Kangren wrote:
> Replace the ternary conditional operator with max() to make the code clean
> 
> Signed-off-by: You Kangren <youkangren@...o.com>
> ---
>  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 829d75ebab42..2a0b33bd2eb8 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -6353,7 +6353,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);

Is that "tmp" useful anymore - why not drop it while at it?

thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ