Re: [PATCH] typec: tcpm: fix a typo in the comparison of pdo_max_voltage

From: Heikki Krogerus
Date: Thu Aug 22 2019 - 11:35:44 EST


On Thu, Aug 22, 2019 at 02:52:12PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> 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")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>

Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
> 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 166b28562395..96562744101c 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1439,7 +1439,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;
> break;
> /*
> --
> 2.20.1

thanks,

--
heikki