From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: R Sundar <prosunofficial@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
RD Babiera <rdbabiera@google.com>,
Guenter Roeck <linux@roeck-us.net>,
Badhri Jagan Sridharan <badhri@google.com>,
Kyle Tso <kyletso@google.com>, Xu Yang <xu.yang_2@nxp.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
frank.wang@rock-chips.com, kernel test robot <lkp@intel.com>,
Julia Lawall <julia.lawall@inria.fr>
Subject: Re: [PATCH linux-next] usb: typec: tcpm: use max() to get higher value
Date: Thu, 26 Sep 2024 16:03:30 +0300 [thread overview]
Message-ID: <ZvVbogBA_mlelt8H@kuha.fi.intel.com> (raw)
In-Reply-To: <20240925122014.552221-1-prosunofficial@gmail.com>
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@intel.com>
> Reported-by: Julia Lawall <julia.lawall@inria.fr>
> Closes: https://lore.kernel.org/r/202409231009.2efXAh9b-lkp@intel.com/
> Signed-off-by: R Sundar <prosunofficial@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.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
prev parent reply other threads:[~2024-09-26 13:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 12:20 [PATCH linux-next] usb: typec: tcpm: use max() to get higher value R Sundar
2024-09-26 13:03 ` Heikki Krogerus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZvVbogBA_mlelt8H@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=badhri@google.com \
--cc=frank.wang@rock-chips.com \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@inria.fr \
--cc=kyletso@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lkp@intel.com \
--cc=prosunofficial@gmail.com \
--cc=rdbabiera@google.com \
--cc=xu.yang_2@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox