From: R Sundar <prosunofficial@gmail.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
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>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
frank.wang@rock-chips.com, R Sundar <prosunofficial@gmail.com>,
kernel test robot <lkp@intel.com>,
Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH linux-next] usb: typec: tcpm: use max() to get higher value
Date: Wed, 25 Sep 2024 17:50:14 +0530 [thread overview]
Message-ID: <20240925122014.552221-1-prosunofficial@gmail.com> (raw)
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>
---
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
next reply other threads:[~2024-09-25 12:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 12:20 R Sundar [this message]
2024-09-26 13:03 ` [PATCH linux-next] usb: typec: tcpm: use max() to get higher value Heikki Krogerus
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=20240925122014.552221-1-prosunofficial@gmail.com \
--to=prosunofficial@gmail.com \
--cc=badhri@google.com \
--cc=frank.wang@rock-chips.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--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=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