typec: tcpm: fix a typo in the comparison of pdo_max_voltage [Linux 4.19.70]

This Linux kernel change "typec: tcpm: fix a typo in the comparison of pdo_max_voltage" is included in the Linux 4.19.70 release. This change is authored by Colin Ian King <colin.king [at] canonical.com> on Thu Aug 22 14:52:12 2019 +0100. The commit for this change in Linux stable tree is e44840b (patch) which is from upstream commit a684d8f. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream a684d8f.

typec: tcpm: fix a typo in the comparison of pdo_max_voltage

commit a684d8fd87182090ee96e34519ecdf009cef093a upstream.

There appears to be a typo in the comparison of pdo_max_voltage[i]
with the previous value, currently it is checking against the
array pdo_min_voltage rather than pdo_max_voltage. I believe this
is a typo. Fix this.

Addresses-Coverity: ("Copy-paste error")
Fixes: 5007e1b5db73 ("typec: tcpm: Validate source and sink caps")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20190822135212.10195-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/usb/typec/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 5f29ce8..fb20aa9 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -1445,7 +1445,7 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
                else if ((pdo_min_voltage(pdo[i]) ==
                      pdo_min_voltage(pdo[i - 1])) &&
                     (pdo_max_voltage(pdo[i]) ==
-                     pdo_min_voltage(pdo[i - 1])))
+                     pdo_max_voltage(pdo[i - 1])))
                    return PDO_ERR_DUPE_PDO;

Leave a Reply

Your email address will not be published. Required fields are marked *